Last active
May 9, 2021 17:14
-
-
Save alecvance/02c56e71c4c2dea9c1f22a88e32e8731 to your computer and use it in GitHub Desktop.
bash script to fix creation dates in a directory (Mac OS X)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd "$1" | |
for f in * ; do | |
SetFile -d "$(GetFileInfo -m $f)" "$f" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When importing files from my Zoom H4n pocket recorder, I was annoyed that the creation date for every file showed up as Unix time zero (as "Dec 31, 1969" to those of us west of GMT; "Jan 1 1970" for the rest of the world), so this is a quick script that will fix all the creation dates in the file specified by setting them to the same as the modification date. This is useful because the mod date will likely be updated but you might be interested in the date/time the actual recording was made.
Example command:
sh ./fix_creation_dates.sh /path/to/folder