Link to home
Start Free TrialLog in
Avatar of ddantes
ddantesFlag for United States of America

asked on

Batch operation to make file creation date equal to file modification date

Running Windows 7 Professional, I recently installed an Outlook Add-in called NEO Find.  When that program created a catalog for indexing, it appears to have set the file modified date of thousands of my archived .eml files to the present date.  The software vendors are skeptical that their application caused this, because NEO Find indexes Outlook pst files, not Outlook Express .eml files.   However, the file modified date of every .eml file was changed to the date and time when NEO Find was installed.  In any case, I've used an application called Total Commander to restore the file modified dates to all those .eml files, based on a backup.  However, Total Commander doesn't change the file creation date.  I'm looking for a way to perform a batch operation which sets the file creation date equal to the file modified date on all .eml files.
Avatar of Giovanni
Giovanni
Flag of United States of America image

Take a look at timestomp, which uses the following Windows system calls:

NtQueryInformationFile()
NtSetInformationFile()

User generated image
Here's a quick one liner:

for /f "delims=" %f in ('dir *.eml /a-d/b/s 2^>nul') do timestomp "%f" -m "Monday 01/01/2001 01:01:01 AM"

Open in new window


See http://www.blackhat.com/presentations/bh-usa-05/bh-us-05-foster-liu-update.pdf
Avatar of ddantes

ASKER

Thank you for your comment.  I downloaded timestompGUI.exe, but it doesn't appear to have the command line interface which is required for a batch operation.   The link  to Timestomp.exe on the page which your link referenced is a dead link.  Is there another version of Timestomp which I should download?
I did notice that after my post and modified the link above to reflect a location hosting the file. ( http://www.jonrajewski.com/resources/ )

If you want to dig in and are familiar with AutoIt, see SetMACE as well, which is an improvement upon timestomp.
Avatar of ddantes

ASKER

Thank you.  OK, now I can open the command window for Timestomp.   I'm not sure how to apply your "one liner."    Just to be sure I've communicated the intended outcome...  I have thousands of .eml files in different subdirectories, but on the same drive letter.  These .eml files have differing, but accurate modified date stamps.  Their date created stamps are inaccurate, all reading today's date.  I'm wanting the file created date changed to match the file modified date.
ASKER CERTIFIED SOLUTION
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

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 ddantes

ASKER

Thank you for your thorough instructions.  I downloaded the trial version of DirDate and performed the following command line operation:
dirdate -r created= current_modified V:\My Documents\Archived Documents\HCA\Email\*.eml

This would test the application on .eml files located in that particular subfolder.

The operation appeared to complete (see screenshot) but the .eml file creation dates in that subfolder have not changed.  Please advise.User generated image
I tested it here...worked perfectly. Please do a right-click on one of the files, then Properties. Are the Created and Modified dates not the same now?
Oh, I think it's the spaces in your filespec. Put quotes around it, i.e.:
"V:\My Documents..." (beginning and ending quotes).
Avatar of ddantes

ASKER

The file creation date for all my .eml files was inadvertently set to Jan. 3, 2013, the date when a certain file operation was performed.  After running DirDate, I don't see any difference (See screenshot of properties of one file in the target directory).
User generated image
Our messages just crossed. I'm pretty sure the problem is the quotes around your filespec...DirDate is not being passed the correct folder name due to the spaces in the parameter.
Avatar of ddantes

ASKER

Yes!  That did it.  Thank you for your help.
Avatar of ddantes

ASKER

Awesome solution!
Excellent! You're very welcome.
Avatar of ddantes

ASKER

Thanks to both Experts who contributed.
SOLUTION
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
Ah, too late.  :)
Avatar of ddantes

ASKER

Thank you, and sorry that didn't appear sooner, in time to share points.
ddantes,
I don't mind at all sharing the points. Click Request Attention at the top and ask for the question to be re-opened. Then you may re-assign the points however you'd like. Regards, Joe
Avatar of ddantes

ASKER

That's kind of you.  I'd like to award some points to the other Expert, because he invested time in developing an alternate solution.
Absolutely! I'm in complete agreement. It is the right thing to do. Regards, Joe
Avatar of ddantes

ASKER

I've asked a moderator to reopen this question so that points can be shared.

Meanwhile, I posted a related question, and perhaps you could have a look...

https://www.experts-exchange.com/questions/28301934/Transferring-time-stamp-data-between-file-types.html
OK, the Moderators are usually fast to act...I'm sure it will be re-opened soon. In the meantime, I'll head over to your related question. Regards, Joe
Avatar of ddantes

ASKER

Thank you.
Avatar of ddantes

ASKER

Thanks to both Experts.
Your welcome, thanks for the points.  :o)