Link to home
Start Free TrialLog in
Avatar of plarry
plarry

asked on

Change directory date & time

I want to change the "Modified" date & time that Windows Explorer shows for a particular directory.  "SetFileTime" works only for files, not directories.

I copied all directories from an old PC to a new one, and all the directories at every level on the new one now show the date of the transfer rather than the date from the old one -- naturally all the file dates/times are as the original PC had them, it's just the directories whose dates are the new ones.

Reason I want the old directory dates is so that I can sort from newest to oldest in the Explorer window.

I could do this manually and tediously for each directory by moving from current location to another temporary one, changing the date/time on the PC, creating the directory name again in the proper location, and then moving all the sub-files from the temporary location back to the newly named directory.  But there are too many directories that this needs to be done for.

Any suggestions?
Avatar of sorgie
sorgie
Flag of United States of America image

That may be your only alternative.
oops, can't verify that it will work for folders but check
actually, just found that it can but only with NT4
Avatar of Azerthur
Azerthur

That's easy man !
It 's so simple arf !

Store the system date
Set the system date to the date you want
Create a folder
set the system date to the previous one.


makeit.bat
date dd/mm/yy
md Folder
date previousone ( in fact you won't be able to do it in a batch but you can also make a C++ or Pascal prog)
Avatar of plarry

ASKER

Thanks to all.  Unfortunately, it looks like W98 doesn't give you the option to change folder dates, or to keep the original folder date when you copy from one area to another.  This strikes me as VERY dumb -- after all, why should files keep their dates but folders lose them? -- but that's where we are.

Azerthur's answer is what I said I could do but didn't want to, in the last paragraph of my question.  I guess I'll take this route, and use APL to drive the process.

....larry
ASKER CERTIFIED SOLUTION
Avatar of glnsoft
glnsoft

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of plarry

ASKER

That does it.  Thanks.

I wish the interface were more direct and readable, and I found that the software changed my current system date and time, but otherwise it worked as promised.

I think I'll write my own utility to copy all directory/subdirectory dates and times from the source computer to the target computer, just to save the long manual input, but this program works great for changing a few files and directories to different date/time and for changing a lot of files to a single date/time.