Solved

Transferring time stamp data between file types

Posted on 2013-11-22
24
409 Views
Last Modified: 2013-11-24
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?
0
Comment
Question by:ddantes
  • 12
  • 12
24 Comments
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 39670795
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
set DIRDATE=-QUIET
"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
0
 

Author Comment

by:ddantes
ID: 39670919
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...
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 39670936
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
0
 

Author Comment

by:ddantes
ID: 39670947
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.
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 39671568
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
0
 

Author Comment

by:ddantes
ID: 39671614
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.
0
 
LVL 51

Accepted Solution

by:
Joe Winograd, EE MVE earned 500 total points
ID: 39671682
OK, that's not a problem, as long as the folder structure of the DOCX files is the same as the folder structure of the backed up WPS files. Starting in the root folder of the WPS files, you would run:

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

Open in new window


Then you would tweak the BAT file, move it to the root folder where the DOCX files are now, and run it from there. As long as the folder structure is the same, the file names/paths in the BAT file will work. But before running it, you need one more tweak, i.e., sort (ascending) the section of the BAT file that contains the files. Everything in the BAT file (other than the five header lines) will start with

"c:\Program Files\DataMystic\DirDate\dirdate.exe" MODIFIED= -date=

So doing a simple ascending sort will put all of the lines with [-date=01/03/13] together – in fact, at the top, since nothing will have a Modified date before that. Now simply delete all of the lines in the BAT file after the last [-date=01/03/13] line. Then when you run the BAT file, only the files with a Modified date of 01/03/13 will be changed by the DirDate call. Regards, Joe

P.S. Need to leave now for a couple of hours. Will check back in with you as soon as I return.
0
 

Author Comment

by:ddantes
ID: 39671845
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.
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 39671904
> 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
0
 

Author Comment

by:ddantes
ID: 39671908
I'll see about a program to perform that step.  Thanks for your expertise!
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 39672031
You're welcome. It should not be a difficult program to write. Would you like me to take a run at it?
0
 

Author Comment

by:ddantes
ID: 39672060
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
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/Windows_7/Q_28302285.html
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 39672074
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
0
 

Author Comment

by:ddantes
ID: 39672097
I'm looking forward to your post.
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 39672211
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
fixdates.tif
0
 

Author Comment

by:ddantes
ID: 39672221
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.
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 39672222
Sounds good.
0
 

Author Comment

by:ddantes
ID: 39672968
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?
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 39672988
Yes. Give me a half-hour or so to write the code, test it, and create a new executable for you.
0
 

Author Comment

by:ddantes
ID: 39673015
Wonderful.  Please take your time.
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 39673035
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
fixdates-v2.tif
0
 

Author Comment

by:ddantes
ID: 39673147
Perfect.  

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.
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 39673257
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
0
 

Author Comment

by:ddantes
ID: 39673294
Good to know.  I'll check your profile.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I hope this helps those who have been battling the SanDisk / U3 problem for a while. For anyone that is running Windows 7 64bit and is receiving and searching the internet for the “Windows Error: Windows has allocated a drive letter to the U3 dri…
I recently purchased an HP EliteBook 2540p notebook/laptop. It has two video ports on it – VGA and DisplayPort. HP offers an optional docking station for the 2540p that also has both a VGA port and a DisplayPort. There are numerous online reports do…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now