![change file time stamp change file time stamp](https://rebrickable.com/media/parts/photos/134/28587pat0003-134-55088f10-0456-43af-9803-78b072d145ab.jpg)
If Not FileWrite ( $sFilePath, "This is an example of using FileSetTime." ) Then MsgBox ( $MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file." ) Return False EndIf Set the modified timestamp of the file to 1st Nov 2003 and use the current time. Local Const $sFilePath = _WinAPI_GetTempFileName ( ) Create a temporary file to read data from. #include #include #include Example () Func Example () Create a constant variable in Local scope of the filepath that will be read/written to. Trying to change a timestamp on read-only files will result in an error.įileGetAttrib, FileGetTime, FileSetAttrib Example Using a date earlier than will have no effect. See FileFindFirstFile() for a discussion about wildcards. $FT_RECURSIVE (1) - directories are recursed into. $FT_NONRECURSIVE (0) - no recursion (Default). $FT_MODIFIED (0) = Last modified (default)Ĭonstants are defined in 3 If the time is blank "" then the current time is used. The new time to set in the format "YYYYMMDDHHMMSS" (Year, month, day, hours (24hr clock), seconds). (* and ? wildcards accepted - See Remarks) Os.FileSetTime ( "file pattern", "time" ] ) Print "ignore dir", os.path.join(root, subpath) Print "ignore file", os.path.join(root, subpath)ĬurrentMaxMtime = max(currentMaxMtime, os.lstat(os.path.join(root, subpath)).st_mtime) import osįor root, dirs, files in os.walk(path, topdown=False, followlinks=False): It recursively sets all directory mtimes to the newest non-excluded file/dir mtime inside. I didn't really like the obscurity of the shell commands and quickly did it in python. If you aren't running it in a script, replace with the folders you want to run it from. #! /usr/bin/env zshįind -depth -type d ! -empty -print0 |while IFS= read -r -d '' do After replacing it with find/read it became much faster, didn't burn memory, and started almost straight away. When testing, I noticed that the performance and memory footprint for **/*(FDod) was insane (over 1.4GB for just 650k folders), and it read the whole lot before starting to touch folders. , the od makes it search in the depth-first manner, so that the parent folder timestamps get updated properly. The FD makes it find non-empty directories, including those starting with. The quotes allow directory entries containing spaces and tabs to work correctly. # Don't do thisįor d in **/*(FDod) do touch -r "$d"/*(Dom) - "$d" done I've taken zsh command and enhanced it to work in subfolders, but it seems that zsh is terribly inefficient for the **/*(FDod) part.
![change file time stamp change file time stamp](http://www.softwareok.eu/img/faq/NewFileTime/File_Name_to_File_Time_Stamp_Example_2019-07-04-13-49-53.png)
The folder "() The Colour and The Shape" would have its timestamp set to 00:52. rw-r-r- 1 jon jon 6086821 00:51 Foo Fighters - Walking After You.mp3
![change file time stamp change file time stamp](https://www.softwareok.com/img/faq/NewFileTime/File_Name_to_File_Time_and_Date_Stamp_2019-07-04-13-55-02.png)
rw-r-r- 1 jon jon 6778011 00:52 Foo Fighters - New Way Home.mp3 rw-r-r- 1 jon jon 4294291 00:52 Foo Fighters - My Poor Brain.mp3 rw-r-r- 1 jon jon 4649556 00:52 Foo Fighters - Monkey Wrench.mp3 rw-r-r- 1 jon jon 5803125 00:51 Foo Fighters - February Stars.mp3 rw-r-r- 1 jon jon 3151170 00:51 Foo Fighters - Enough Space.mp3 So for Fighters/() The Colour and The Shape$ ls -alF
CHANGE FILE TIME STAMP HOW TO
I was wondering if anyone knows how to change the timestamps of folders recursively based on the latest timestamp found of the files in that folder.