Here is a small snippet of shell script, that could be used if you want to change the file or folder attributes. Such as creation date or modified date.
find YOUR_DIRECTORY_NAME -print | while read filename; do
# This will change the creation date of all the files under 'YOUR_DIRECTORY' SetFile -d '12/31/2015 04:12:45' "$filename"
# This will change the Modified and Last opened date.
#Format : yyyymmddhhmm
touch -t 201512310537 "$filename" done
Usage:
- Save the script in to a .sh file.
- Edit the two directory name and date variables as necessary.
- Make it executable by chmod a+x scriptName.sh
- Either drag in to the terminal app or make Terminal the default app to open.
Note: SetFile is a utility that comes with Xcode.
Reference:
Originally published at nishabe.wordpress.com on October 4, 2016.