Site Sponsors:
Clone File Dates & Times 
I would be willing to wager that anyone who copies files on Linux has been stung by this one: After copying your files from one place, to another, you notice that the file dates & time have been changed?

While there are many ways to deal with the problem, few I have seen allow us to create a snapshot of the "good" file data (mtime) so as to apply them over several other copies... especially when we have thousands of files, scattered about different (let alone, multiple!) cloned-tree locations?

Submitted for your enjoyment therefore, we felt the need to share our 'cpdates.py' strategy with you.



All we need do is to (1) create a snapshot of the good-tree, then (2) apply those dates over the destination tree. Upon (2), the script will replace the source, with the destination folder-location & then apply the snapshot source file's date & time to the destination file.

By way of a bonus, any (1) can be used over many (2)s.

Source Code: cpdates.py

Students who are interested in learning how to work with file information in Python 3 on Windows, Linux, macOS and elsewhere will also enjoy our Python 3000 training opportunity.


Note: For our purposes, we wanted the mtime of the source, to become the mtime + atime on the destination. --Your mileage might vary?



Google Fodder: touch recursive delta fix stat apply recover recovery


[ view entry ] ( 31 views )   |  permalink  |  related link

| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Next> Last>>