Created
May 4, 2015 15:02
-
-
Save pavgup/0bbf8a84334736512b1e to your computer and use it in GitHub Desktop.
Find all images in a directory, create a backup subdirectory in the current directory, and then copy these images to the backup folder. Preparation for keeping track (poorly) of original files that are being optimized.
This file contains 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
#!/bin/sh | |
mkdir backup; \ | |
for file in $( | |
find . -exec \ | |
file {} \; | \ | |
awk -F':' '{ if ($2 ~/[Ii]mage|EPS/) print $1,"\n"}'| \ | |
sed s/\.//); | |
do | |
cp -R -v .$file ./backup/ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment