Skip to content

Instantly share code, notes, and snippets.

@csu
Created August 31, 2012 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csu/3555291 to your computer and use it in GitHub Desktop.
Save csu/3555291 to your computer and use it in GitHub Desktop.
Copy creation dates of files from a mirror directory
# Part of the txt-to-dayone repository: https://github.com/christophersu/txt-to-dayone
IFS=$'\n'
files=$(ls | egrep '(.txt)')
for i in $files; do
#get original creation dates
original=$( GetFileInfo -d "$i" )
#change the creation date of the same file in the destination
if [ -e "/Users/christophersu/Desktop/test/$i" ]; then
SetFile -d "$original" "/Users/christophersu/Desktop/test/$i"
fi
done
unset IFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment