DonationCoder.com Software > Coding Snacks
Update Timestamp of file based on time in filename
dcwul62:
Thanks 4WD.
I'll check it out. Right now I seem to have issues with executing .ps1 file (executionpolicy, whatever)
wraith808:
Thanks 4WD.
I'll check it out. Right now I seem to have issues with executing .ps1 file (executionpolicy, whatever)
-dcwul62 (April 03, 2018, 03:19 AM)
--- End quote ---
You need to change the execution policy to run many powershell scripts
https://www.addictivetips.com/windows-tips/how-to-change-the-powershell-execution-policy/
highend01:
Alternatively, try this...
Written in PureBasic.
Accepts one parameter, the filename (put it in quotes if it contains spaces)!
It is a command line app, the return values are the following:
0 = Everything went fine, modified time should be set correctly
1 = You forgot to call it with a filename
2 = The filename does not exist!
3 = There isn't a space where it should be (between date and time in the filename)
4 = Either the date or the time doesn't have the expected length (8 chars for the date, 6 for the time)
5 = 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)
dcwul62:
Thanks.
The idea is to do this in a batch, i.e. for multiple files simultaneously.
For years I have this script that is doing exactly what I want.
It is working fine, with just 1 exception...
updating time, when the date format in the file is yyyymmdd
In case the date format is ddmmyyyy then it is okay.
So far I manually update the time of such files using the change date time attributes
within Opus. It is not a big issue, but I would like to have it in a script.
Have sent skwire the script by PM.
So, let's wait for his feedback.
Anyway, many thanks so far!
Truly appreciate your support.
PatchToFiles-Video_2018-04-04_091419.wmv (400.27 kB - downloaded 470 times.)
skwire:
Have sent skwire the script by PM.-dcwul62 (April 04, 2018, 02:23 AM)
--- End quote ---
If possible, please post the script here so everybody can help. :up:
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version