Skip to content

Instantly share code, notes, and snippets.

View LongYC's full-sized avatar

LongYC LongYC

View GitHub Profile
@LongYC
LongYC / copyflat.sh
Last active June 13, 2018 16:00
Copy all files with specified extension from a source directory and its subdirectories into a destination directory.
# chmod 755 copyflat.sh
# ./copyitune.sh m4a /my/iTune/ /my/destination/
# $1 = file extension.
# $2 = source directory.
# $3 = destination directory.
echo "Copy all $1 files in $2 to $3"
find $2 -name "*.$1" -exec cp {} $3 \;
@LongYC
LongYC / changedate.sh
Last active June 13, 2018 16:01
Change the creation and modification date of a file.
# chmod 755 changedate.sh
# ./changedate.sh my_edited_photo.jpg 201504010000
# $1 = filename.
# $2 = date in YYYYMMDDhhmm.
echo "Changing the creation date of file: $1 to date: $2"
touch -t $2 $1 .