How to MODIFY the TIME stamp of a DIRECTORY?

How to MODIFY the TIME stamp of a DIRECTORY?

Post by Michael Boo » Wed, 24 Jun 1992 22:24:45



I'm writing a little utility to move file and whole directory trees
under msdos.

The moved tree should look like the original tree.
Directory attribute and time should be preserved.

But I dont't know how to modify the time stamp of a directory.

There are DOS functions to modify the time (INT 21, AH=57h),
but this function requires a file handle.

Maybe this could be done by an fcb compatible call?
I could not believe, that this is inpossible under MSDOS.
Ok, I know you can edit the directory sector manually,
but this won't work in a networking environment.

Any ideas?

--

 
 
 

How to MODIFY the TIME stamp of a DIRECTORY?

Post by Myse » Fri, 26 Jun 1992 06:03:22


   I do not have the resources right now to give a complete source, but when
you read/write files/directories/whatever, there is a part of the file info
that give the t/d stamp. You need to read that, save it, move the stuff, then
replace it. Maybe someone with a full library could give you a source. The only
place I saw it discussed was in a paper on viruses, where it presented as an
example of a defensive mechanism. And that was not a complete source.

        Here spooky spooky spooky!
        Read this, and find the subliminal anarchist messages!
        Holdover from a recent discussion on security. (whats that?!?)

 
 
 

How to MODIFY the TIME stamp of a DIRECTORY?

Post by Doug Mill » Sun, 28 Jun 1992 15:07:15



>    I do not have the resources right now to give a complete source, but when
> you read/write files/directories/whatever, there is a part of the file info
> that give the t/d stamp. You need to read that, save it, move the stuff, then
> replace it. Maybe someone with a full library could give you a source. The on
> place I saw it discussed was in a paper on viruses, where it presented as an
> example of a defensive mechanism. And that was not a complete source.

>    Here spooky spooky spooky!
>    Read this, and find the subliminal anarchist messages!
>    Holdover from a recent discussion on security. (whats that?!?)

Here's another thought.  Couldn't you use _dos_setfileattr to change the
"file" attributes from a subdirectory type to a normal file type (this is
via DOS subfunction 0x43 if your compiler doesn't support it.)  Then use
_dos_setftime to change the timestamp (DOS subfunction 0x57).  Then
another call to _dos_setfileattr to change it back to a subdirectory
type?
This method should also work as a way to change the subdirectory name.

--

 
 
 

How to MODIFY the TIME stamp of a DIRECTORY?

Post by Stan Bro » Tue, 30 Jun 1992 07:55:31



>Here's another thought.  Couldn't you use _dos_setfileattr to change the
>"file" attributes from a subdirectory type to a normal file type (this is
>via DOS subfunction 0x43 if your compiler doesn't support it.)  Then use
>_dos_setftime to change the timestamp (DOS subfunction 0x57).  Then
>another call to _dos_setfileattr to change it back to a subdirectory
>type?
>This method should also work as a way to change the subdirectory name.

Should? Well, maybe.   Does?  nope!

DOS function 4301 won't change attributes of a directory or of a volume
label.  Reference:  Ralf Brown's interrupt list (see the FAQ if you want
to obtain a copy.)  (*)

The only way I know of to change the date/time of a subdirectory is the
same as the only way I know to change its attributes:  Overwrite the
disk sector that stores the directory's entry in its parent directory.
Norton Utilities (and I'm sure its competitors too) does this quite well.

(*)  I posted the FAQ list a couple of days ago, so it should be current
on your system.

If you don't know how to search a newsgroup for articles, ask someone at
your site or (better) check the printed or on-line manuals.  If those
resources fail, you can post a query in news.newusers.questions, being
sure to mention the names and versions of your operating system and your
newsreader, and the fact that you've checked the documentation and asked
your sysadmin before posting.

If you've searched news.answers and the FAQ list you're seeking isn't
there, send me email and I'll respond with a canned set of instructions
on retrieving FAQ lists from archive sites.  Important:  Make sure that
your message bears a valid reply-to address.  I don't have the knowledge
to debug faulty mail paths.  If you don't receive a reply from me within
a reasonable time (certainly within 5 days), check with your sysadmin to
verify whether your software is generating a valid reply-to address.

--

 
 
 

How to MODIFY the TIME stamp of a DIRECTORY?

Post by Ralf.Br.. » Tue, 30 Jun 1992 20:08:48



}DOS function 4301 won't change attributes of a directory or of a volume
}label.  Reference:  Ralf Brown's interrupt list (see the FAQ if you want
}to obtain a copy.)  (*)

Actually, it will change the attributes of a directory, but not the
directory bit itself (so you can't change a directory to a file or vice
versa).  And to change the directory's attributes, you'll also need to
clear the directory bit in the desired attribute byte before calling DOS.

--

FIDO: Ralf Brown 1:129/26.1  |"Wisdom is the quality that keeps you from

AT&Tnet: (412)268-3053 school|              -- Doug Larson

 
 
 

How to MODIFY the TIME stamp of a DIRECTORY?

Post by Kar » Thu, 02 Jul 1992 02:08:30




>Here's another thought.  Couldn't you use _dos_setfileattr to change the
>"file" attributes from a subdirectory type to a normal file type (this is
>via DOS subfunction 0x43 if your compiler doesn't support it.)  Then use
>_dos_setftime to change the timestamp (DOS subfunction 0x57).  Then
>another call to _dos_setfileattr to change it back to a subdirectory
>type?
>This method should also work as a way to change the subdirectory name.

It should, but it doesn't.

DOS does not allow to modify the directory attribute.

>--


 
 
 

How to MODIFY the TIME stamp of a DIRECTORY?

Post by Myse » Fri, 03 Jul 1992 04:31:34


please note that all of the stuff that I actually wrote is not there.
I would not want to give a false impression on this subject :)
Anyway, back to your regularly scheduled newsgroup......

>>Here's another thought.  Couldn't you use _dos_setfileattr to change the
[stuff deleted]
>>This method should also work as a way to change the subdirectory name.
>It should, but it doesn't.
>DOS does not allow to modify the directory attribute.
>>--


      Is there a way to get a .sig on here without using a .signature file?
        My news rejects .signatures


 
 
 

How to MODIFY the TIME stamp of a DIRECTORY?

Post by Kar » Fri, 03 Jul 1992 20:22:31





Doug Miller) writes:

>please note that all of the stuff that I actually wrote is not there.
>I would not want to give a false impression on this subject :)
>Anyway, back to your regularly scheduled newsgroup......
>>>Here's another thought.  Couldn't you use _dos_setfileattr to change the
>[stuff deleted]
>>>This method should also work as a way to change the subdirectory name.
>>It should, but it doesn't. DOS does not allow to modify the directory
>>attribute.

You may have noticed that my comment *ONLY* referred to the last paragraph
on _dos_setfileattr, and that the text of this paragraph in your original
posting (which YOU deleted in your follow-up) clearly indicates the purpose
of your posting (as does the Subject field).  I felt that there is no need
indeed to indefinitely repeat the contents of the original posting in a
longer thread, especially if they are of no relevance to the point I wanted
to make (i.e., that DOS does not allow you to change the Directory bit of a
file attribute byte). However, I apologize for not having made a "stuff
deleted" note. No insult to you meant!

Regards
Karl Riedling
    +----------------------------------------------------------------------+
    | Dr. Karl Riedling              |                                     |

    | Institut fuer Allgemeine       |                                     |
    | Elektrotechnik & Elektronik    | Phone: +43-1-588 01-3846            |
    | A-1040 Vienna, Austria, Europe | Fax:   +43-1-505 2666               |
    +----------------------------------------------------------------------+