I have a few ZIP files in a folder; I want to change their modified date to three days ago. How do I do that?
My operating system is Windows Vista.
I'll assume that this is a programming question (even though it isn't). In this case, you would use the SetFileTime
function of WinAPI with your file handle.
BOOL WINAPI SetFileTime(
__in HANDLE hFile,
__in_opt const FILETIME *lpCreationTime,
__in_opt const FILETIME *lpLastAccessTime,
__in_opt const FILETIME *lpLastWriteTime
);
You can use BulkFileChanger from Nirsoft for this purpose.
If you want to change the file time programmatically you can use the SetFileTime function. To convert between different time formats you can use TzSpecificLocalTimeToSystemTime and SystemTimeToFileTime. In order to get a handle to the file use CreateFile.
UnxUtils is one of many tool sets which has ported the handy (pun intended) touch
tool with several options and switches:
touch --help
Usage: touch [OPTION]... FILE...
Update the access and modification times of each FILE to the current time.
-a change only the access time
-c do not create any files
-d, --date=STRING parse STRING and use it instead of current time
-f (ignored)
-m change only the modification time
-r, --reference=FILE use this file's times instead of current time
-t STAMP use MMDDhhmm[[CC]YY][.ss] instead of current time
--time=WORD access -a, atime -a, mtime -m, modify -m, use -a
--help display this help and exit
--version output version information and exit
STAMP may be used without -t if none of -drt, nor --, are used.