Avatar of ddantes
ddantesFlag for United States of America asked on

Transferring time stamp data between file types

Early this year (in January) I converted over one thousand .wps files (Microsoft Works 2000) to .docx (Microsoft Word 2007).  The file names were not changed, only the file extension.  I wish the .docx files retained the timestamp of the .wps files, but of course all of the .docx files were assigned the date Jan. 3, 2013.   I'm wondering if there is a way to transfer the time stamp data from .wps files (which I still have in a backup) to .docx files with the same file name?
Windows 7

Avatar of undefined
Last Comment

8/22/2022 - Mon
Joe Winograd

Hi ddantes,

DirDate will be your hero again. :)

I attached the DirDate syntax to your previous question. The method described in this answer was derived from the section in that syntax document called Report Mode, which was designed for this purpose, although one tweak is needed. Report Mode is used to save the dates from one folder and then apply them to a new folder. This is exactly what you want, except that the files in the new folder have a different file type...easy enough to tweak!

First, run DirDate with the [-report] option in the backup folder that has the WPS files with the correct date/time stamps, as follows:

V:       <or whatever drive letter has your WPS files>
cd folder_with_WPS_files
"c:\Program Files\DataMystic\DirDate\dirdate.exe" -report -r ALL= *.wps > report.bat

The ALL= (note the space after this and before *.wps) parameter will capture ALL of the date/time fields (MODIFIED, CREATION, LASTACCESS) for all of the WPS files (because of the wildcard *.wps). You will now have a BAT file called <report.bat> in the folder with the WPS files. It will look like this:

@echo off
rem Generating DirDate Report
rem Save this batch file in the target folder and then run it
rem The following line controls DIRDATE settings to be applied to all lines in this file
"c:\Program Files\DataMystic\DirDate\dirdate.exe" MODIFIED= -date=11/18/13 -time=14:50:04 ".\file1.wps"
"c:\Program Files\DataMystic\DirDate\dirdate.exe" CREATION= -date=11/22/13 -time=20:02:21 ".\file1.wps"
"c:\Program Files\DataMystic\DirDate\dirdate.exe" LASTACCESS= -date=11/22/13 -time=20:02:21 ".\file1.wps"
"c:\Program Files\DataMystic\DirDate\dirdate.exe" MODIFIED= -date=11/18/13 -time=09:16:52 ".\file2.wps"
"c:\Program Files\DataMystic\DirDate\dirdate.exe" CREATION= -date=11/22/13 -time=20:02:21 ".\file2.wps"
"c:\Program Files\DataMystic\DirDate\dirdate.exe" LASTACCESS= -date=11/22/13 -time=20:02:21 "file2.wps"

Open in new window

Now here's the tweak. Load this batch file into a text editor, such as Notepad, and change all occurrences of ".wps" to ".docx", so that the date/time stamps that were captured from the backed up WPS files are applied to the DOCX files that have the same file names. Copy this tweaked BAT file into the folder where the DOCX files are and run it.

If you don't want to change all three dates, then you can either remove the lines you don't want from the BAT file (such as all of the LASTACCESS lines) or you can run the DirDate Report Mode command with just one of the date fields (instead of the ALL= param), such as:

"c:\Program Files\DataMystic\DirDate\dirdate.exe" -report -r CREATION= *.wps > report.bat

And, if you want, after moving, tweaking, and running that BAT file, you can run the DirDate Report Mode command again with a different date field, such as:

"c:\Program Files\DataMystic\DirDate\dirdate.exe" -report -r MODIFIED= *.wps > report.bat

Then move, tweak, and run this one, too.

That should do it for you! Regards, Joe

Hi Joe:  I've been away for several hours and just got your response.   I'll get to work on this shortly.  Your instructions are much appreciated...
Joe Winograd

OK, it's the wee hours in my neck of the woods, so I'm headed for some sleep now. Will check in with you first thing in the morning. I'm confident we can get it working for you. I tested it here earlier and it worked like a charm. Regards, Joe
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes

I'm calling it a night, too.  However, I didn't think this question through as well as I might have, when I posted it. There were many thousands of .wps files which were converted to .docx on 1/3/13.  Most of those .docx files have been modified since that time, and I don't want to replace their date modified timestamps with the timestamp of their "parent" .wps file.   The only .docx files whose date modified timestamps should be replaced are those whose date modified is 1/3/13, and there are around 1200 of those, distributed among many subfolders.  Is there an approach which would accomplish that?

I've created the report.bat for the .wps files, and tweaked it by replacing all instances of .wps with .docx.  I also created a "backup.bat" with the existing timestamps of all .docx files, in case something goes awry and I need to restore the present data.  I also purchase a license for DirDate.
Joe Winograd

OK, let's think this through before doing anything...make sure we understand the specs for the process. I suggest approaching this by analyzing the three date/time fields:

Created: The Created value should always be the date/time of the WPS file – but see an important caveat below in the LastAccessed paragraph. This is achieved by running DirDate's Report Mode beginning in the root of the folders where the WPS files are and specifying the Created option (created= ), the Recurse option (-r), the Report option (-report), then tweaking <report.bat> as already discussed (replacing all .WPS occurrences with .DOCX), and then moving and running it.

Modified: If the Modified date/time of a DOCX is after the modified date/time of its corresponding WPS, then do not change the value of the DOCX. If this is too difficult to do, then an approximation (which is probably easier to do) is to change the Modified date/time on any DOCX whose Modified date is 1/3/13. The reason that it's an approximation is that it's incorrect for a DOCX that was modified later in the day on 1/3/13 – the date will be right, of course, but the time will be wrong – do you care?

LastAccessed: This is pretty much meaningless, since all of the WPS files will have a LastAccessed date/time of when you did the conversion to DOCX, unless the backed up WPS files were copied to the backup location before the conversion was done. But in that case, the WPS files in the backed up location will have a Created (and LastAccessed) value of when you copied them to the backup location. So the only way that the WPS files have valid Created date/time stamps is if they're in their original locations – I hope this is the case. But no matter where they were when you did the conversion, LastAccessed will be either the date/time of the conversion or the date/time of the backup, and neither is the "real" LastAccessed date/time that you'd like to have. So the bottom line is – ignore this field!

Let me know if you see any of this differently. Btw, good move on purchasing the DirDate license. It is a terrific utility at a reasonable price. Regards, Joe

Thank you for those specifications.  Unfortunately, I didn't keep the original .wps files on my computer after converting them to .docx, so the creation date is the date of the backup.  However, that's not as important to me as the modified date.

With respect to your instructions for the modified date, I don't know how to change the timestamp selectively on files with a modified date of 1/3/13.  If all the .docx files were in a single subdirectory, I could probably manage it.  But they're scattered across many hundreds of subdirectories -- fortunately al within one folder.  Do you have a suggestion?

The date is what matters to me, not the time of day.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Joe Winograd

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

That's very helpful.  However, once I tweaked the report.bat to replace .wps with .docx, and performed the ascending sort, I realized that none of the modified dates are 1/3/13.   That date applies to the .docx files which were derived from the .wps files.  The .wps files retained their accurate modified dates, which need to be transferred to .docx files with the 1/3/13 time stamp.

I also had a little challenge with the ascending sort operation.  I pasted the report.bat contents into a single field of a database, and after sorting, the order ascended by day, then by month, then by year.  So the years were not grouped together as I had expected.

I apologize that this question has become more complex than I anticipated.
Joe Winograd

> I realized that none of the modified dates are 1/3/13

Ah, of course, good catch. I think you'll need a program to achieve this. The program will loop through all of the DOCX files looking for a Modified date of 1/3/13. When it finds one, it will then get the Modified date/time from the corresponding WPS file with the same name/path and apply that Modified value to the DOCX file. Sound right?

> I pasted the report.bat contents into a single field of a database

I use a text editor with sorting capability, but if you don't have such a product, then paste all of the lines as-is into Excel. It will put each line into a row and it will treat the line as one giant text field, so sorting will work fine.

> I apologize that this question has become more complex than I anticipated.

No apology needed...happens often! Regards, Joe

I'll see about a program to perform that step.  Thanks for your expertise!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Joe Winograd

You're welcome. It should not be a difficult program to write. Would you like me to take a run at it?

Joe, thank you for your kind offer.  I was able to replace the modified dates for most of the files with a little effort.  Only around 65 out of some 1153 files still have the 1/3/13 time stamp.    If you feel inclined to write the program, I'd be happy to implement it on the remaining files.  However, the magnitude of the issue has been reduced significantly, with your assistance.

Aside from that, if you would be interested in one more task, related to this project, I posted it at
Joe Winograd

Our emails crossed, as I just responded to your other question. The program is done...just want to do a little more testing. I need to leave now for an hour or so. Will post the program later tonight. Meanwhile, DirDate -FILEFIX is the answer to your other question! Regards, Joe
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

I'm looking forward to your post.
Joe Winograd

The program is attached. It is an executable (EXE file), but EE does not allow uploading EXE files, so I made the file type TIF. But, to be clear, it is not a TIF file. I called it that only so I could upload it. It is really an EXE file, so after you download it, you must rename it from <fixdates.tif> to <fixdates.exe>.

Then run it. First, it will prompt you to navigate/browse to (or enter or paste) the folder containing the Word (doc/docx) files:
fixdates word folderSecond, it will prompt you to navigate/browse to (or enter or paste) the folder containing the WPS files:
fixdates WPS folderThen it will ask you to confirm that the folders are correct:
fixdates confirm foldersAs it runs, it will display a green progress bar showing what file is currently being processed and what its Modified date/time is in YYYYMMDDhhmmss format:
fixdates progress barIt may go by too fast for you to read the text, but the point is that you'll know it's working as the green bar moves to the right. When it's done, it will give you a summary of what it did:
fixdates operation completedThe program does what we discussed above, namely:

Loops through all of the Word files (.doc and .docx) looking for a Modified date of 1/3/13. When it finds one, it gets the Modified date/time from the corresponding WPS file with the same name/path and it applies that Modified value to the Word file. That's it! Regards, Joe

That's wonderful.  Very kind of you to make that effort.  I'm a little fatigued with sitting in front of the computer just now, so I'll give this a test tomorrow, and post back with the results.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Joe Winograd

Sounds good.

Good Morning Joe:  I ran the program, and the time stamps of  around sixty .wps files were transferred to .doc and .docx files which were previously dated 1-3-13.  However, if a .docx file with the date 1-3-13 did not have a matching .wps file in the source, or if the path was different, the .docx modified date was set to today's date.  So I restored the 1-3-13 time stamps to those 60+ files, using a backup from yesterday.  Is there a way to avoid changing the modified dates of .docx files without matching .wps files?
Joe Winograd

Yes. Give me a half-hour or so to write the code, test it, and create a new executable for you.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

Wonderful.  Please take your time.
Joe Winograd

OK, new version attached. Just one change: if the Word file does not have a matching WPS, then the Modified date of 1/3/13 on the Word file is left unchanged. As with the previous version, I made the file type TIF for uploading purposes. But it is really an EXE file, so after you download it, rename it from <fixdates-v2.tif> to <fixdates-v2.exe>. Let me know if you have any problems with this version. Regards, Joe


Now,  since I've been focusing on this problem, I've found some additional issues on my system, which I'd like to address.  However, the scope of these projects may be unreasonable for an uncompensated forum.  If it's more appropriate for me to hire a professional programmer, please let me know, as I don't want to impose on your (and other Experts') generosity.   Based on your response, I will either post new questions, or seek a programmer's assistance.

The smaller of the two issues relates to the present project.  There are still 56 .docx files whose time stamps have not been updated, either by DirDate or fixdates.exe.  The reason is that the pathways have changed since the creation of the backup which contains the .wps files.   Is there a way to transfer time stamps to .docx dated 1-3-13, based on file name, ignoring the path?

The larger issue relates to an oversight which I made on 10-13-12, when I moved around 107,000 data files from a hard disk into a NAS.  The method which I used resulted in all timestamps being changed to 10-13-12.  There was another method available, which would have preserved the time stamps!  Not realizing my mistake, I deleted the original files.  I have a data backup from January of 2012, and I've used Total Commander to overwrite timestamps for around 15,000 files with accurate data.  Some 18,000 files had been modified, or created, after the backup was made, and those timestamps were not adjusted.  Around 74,000 file timestamps dated 10-13-12 have yet to be corrected, and some pathways have changed since the backup was made.   I'd like to fix these outstanding files, if there is a reasonable way to do it.

If these projects are appropriate for Experts Exchange, I'll post questions.  Otherwise, I'm happy to use a service like ODesk to find a contractor.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
Joe Winograd

Great! I'm glad that you found fixdates-v2 to be "Perfect".

It's an interesting issue as to where one draws the line on gratis work. But your instincts are correct, in my opinion, that at some point, projects are unreasonable for an uncompensated forum. I've been on both sides of this at EE – I've been hired by some members to do paid work and I've hired some members to do paid work. However, it's important to comply with EE's Code of Conduct, which is part of its Terms of Use. In particular, the Code of Conduct says,
You shall not engage in any of the following activities, which are strictly prohibited...

Advertising, promoting in any way or offering to sell any goods or services for any commercial purpose.

Soliciting individuals for employment other than in designated areas (for example, within a discussion thread).

You and I haven't violated either of these codes, since I haven't offered to sell you any goods or services and you haven't solicited me for employment other than in this thread (and, actually, not even that).

I can't decide for you on whether you should continue to post questions here at EE for the issues you mentioned above or hire a professional programmer – that's your call. Also, I don't know anything about oDesk, so can't begin to address that. But if you'd like to discuss these items with me outside of EE, please look at my EE profile and send me an email at the address in there. This is permitted by EE (email addresses are OK in profiles but not in threads), and it is the way that I have hired EE members to do work, and have been hired by EE members to do work, all in compliance with EE's Code of Conduct. Regards, Joe

Good to know.  I'll check your profile.