DonationCoder.com Software > Coding Snacks
Update Timestamp of file based on time in filename
highend01:
This one does it for all files in a folder (not recursively)...
Accepts one parameter, the foldername (put it in quotes if it contains spaces, full path required)!
It is a command line app, the return values are the following:
0 = Everything went fine, modified times should be set correctly
1 = You forgot to call it with a foldername (full path)
2 = The folder does not exist!
3 = Setting the new modified date failed (could e.g. happen if you try to change a date for a file in a UAC protected directory, and the app was not called with admin permissions)
Ofc this version just skips all files that do not fulfill the requirements...
4wd:
...
updating time, when the date format in the file is yyyymmdd
In case the date format is ddmmyyyy then it is okay.-dcwul62 (April 04, 2018, 02:23 AM)
--- End quote ---
I have an idea, how about you standardise your filenames instead of having other people try and conform to your seemingly chaotic system?
It started off with:
yyyymmdd_hhmmss
ddmmyyyy_hhmmss
Now it appears that yyyy-mm-dd_hhmmss is also to be included, no doubt there's also dd-mm-yyyy_hhmmss plus who knows what other combinations.
Choose a format and do a rename of all the non-conforming files before running the script that sets the timestamps and then the whole process becomes simpler for everyone.
Updated
dcwul62:
I have a regex for almost every format. Opus vbs script containing all kinds of possibilities. (If this then that, etc.).
With [-\s_]* I cover 99% of the cases.
The only exception is mentioned in my earlier post, specifically updating the time stamp only (date is updated)
Anyway, I suggest to drop the issue. It is not worth spending more time on.
Would like to thank you all for thinking along! Really appreciated.
Navigation
[0] Message Index
[*] Previous page
Go to full version