Instead of adding a new command in xplorer² for deep folder touching, I present here a solution that can shift modification dates by a fixed amount backward or forward. It is a windows scripting host VBS script, whose essense minus error checking is:
REM create shell object for file path = WScript.Arguments(0) i = InStrRev(path, "\") name = mid(path, i+1) path = left(path, i) Set objShell = CreateObject ("Shell.Application") Set objFolder = objShell.Namespace (path) set objFile = objFolder.ParseName(name) szDate = objFile.ModifyDate i = cint(WScript.Arguments(1)) ' take sign into account objFile.ModifyDate = DateAdd("h", i, szDate)
funny that DOS console doesn't have any command for file dates manipulation
This script operates on one file at a time. It uses the ModifyDate property to read and change the modification date, plus DateAdd for date arithmetic. You must pass the filename and the amount of hours to shift as 2 command line arguments, e.g.
cscript chmdate.vbs c:\test.txt 2
would change the date of TEST.TXT by 2 hours (added to whatever it was before). You can run this command from xplorer² addressbar while browsing the folder where you extracted the CHMDATE.VBS script file. Try it with a couple of test files to get a feeling of it.
we are using the console server CSCRIPT to simplify passing arguments to the script
How to change dates of many files en masse
There are many ways to apply this script in xplorer² e.g. composing a batch script with <Ctrl+B>, but let's do it via a user command instead.
Note at step 2 we use a double >> prompt to repeat the command for all selected files. Otherwise a single > would execute the command once passing all the selected files as a collection argument |
![]() |
I understand we are in the middle of the summer so this script isn't going to be required for some months, but at least you have ample time to understand the ins and outs of its workings till you actually need it next fall <g>
Post a comment on this topic »