?
Solved

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

Posted on 2013-11-22
26
Medium Priority
?
1,766 Views
Last Modified: 2013-12-10
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.
0
Comment
Question by:ddantes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 8
  • 5
26 Comments
 
LVL 15

Expert Comment

by:Giovanni Heward
ID: 39669968
Take a look at timestomp, which uses the following Windows system calls:

NtQueryInformationFile()
NtSetInformationFile()

Timestomp MACE value change
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
0
 

Author Comment

by:ddantes
ID: 39670050
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?
0
 
LVL 15

Expert Comment

by:Giovanni Heward
ID: 39670057
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.
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:ddantes
ID: 39670087
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.
0
 
LVL 55

Accepted Solution

by:
Joe Winograd, EE MVE 2015&2016 earned 1600 total points
ID: 39670280
Hi ddantes,

I recommend DataMystic's DirDate:
http://www.datamystic.com/dirdate.html

The command line syntax is:

dirdate [options] [date parts] <filespec>

Here's how/why the parameters should be set up:

o  Since you have thousands of files in different subdirectories, you'll need "-R" (Recurse into subdirectories) in the [options].

o  I'm presuming you want to do this just on the EML files, so the <filespec> should be <D:\start_dir\*.eml>. If not, just change the wildcard to be whatever you want (and, of course, set the drive letter and starting directory path as needed).

o  You want to change the CREATED date, so you'll need "CREATED=" in the [options].

o  On each file, you want to change its CREATED date to its current MODIFIED date, so you'll need "current_modified" in the [date parts].

Adding all this up, here's the command you need:

dirdate -r created= current_modified d:\start_dir\*.eml

(There's a space between the equal sign and current_modified.)

Also, I've attached the full syntax for you in a PDF file, in case you want to see the other capabilities that it has. It is an extraordinarily powerful utility for dealing with file and folder dates. They offer a full-featured, 30-day free trial, so you can see if it works well for you before buying it.

Btw, that testimonial from me on the site is, indeed, exactly what I said, but as a disclaimer, I want to emphasize that I have no affiliation with this company and no financial interest in it whatsoever. I am simply a happy user/customer (and I paid for the software). Regards, Joe
DirDate-command-line-syntax.pdf
0
 

Author Comment

by:ddantes
ID: 39670392
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.DirDate command window
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 39670406
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?
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 39670422
Oh, I think it's the spaces in your filespec. Put quotes around it, i.e.:
"V:\My Documents..." (beginning and ending quotes).
0
 

Author Comment

by:ddantes
ID: 39670425
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).
File properties after running DirDate
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 39670431
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.
0
 

Author Comment

by:ddantes
ID: 39670433
Yes!  That did it.  Thank you for your help.
0
 

Author Comment

by:ddantes
ID: 39670436
Awesome solution!
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 39670438
Excellent! You're very welcome.
0
 

Author Comment

by:ddantes
ID: 39670442
Thanks to both Experts who contributed.
0
 
LVL 15

Assisted Solution

by:Giovanni Heward
Giovanni Heward earned 400 total points
ID: 39670444
Sorry for the delay, here's the batch script which will work with timestomp.

@echo off
setlocal enabledelayedexpansion
set ext=eml
for /f "delims=" %%f in ('dir *.!ext! /a-d/s/b') do (
	set file=%%f
	for /f "tokens=1-5" %%a in ('timestomp "!file!" -v^|find "Modified"') do (
		if [%%a] == [Modified:] (
			set daystamp=%%b
			set datestamp=%%c
			set timestamp=%%d
			timestomp "!file!" -c "!daystamp! !datestamp! !timestamp!"
		)
	)
)

Open in new window

0
 
LVL 15

Expert Comment

by:Giovanni Heward
ID: 39670448
Ah, too late.  :)
0
 

Author Comment

by:ddantes
ID: 39670466
Thank you, and sorry that didn't appear sooner, in time to share points.
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 39670486
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
0
 

Author Comment

by:ddantes
ID: 39670557
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.
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 39670564
Absolutely! I'm in complete agreement. It is the right thing to do. Regards, Joe
0
 

Author Comment

by:ddantes
ID: 39670711
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...

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/Windows_7/Q_28301934.html
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 39670768
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
0
 

Author Comment

by:ddantes
ID: 39673170
Thank you.
0
 

Author Closing Comment

by:ddantes
ID: 39673171
Thanks to both Experts.
0
 
LVL 15

Expert Comment

by:Giovanni Heward
ID: 39709279
Your welcome, thanks for the points.  :o)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question