Created
February 23, 2017 10:00
-
-
Save akfreas/b7690705b2aa2b27d1debcb41624f60f to your computer and use it in GitHub Desktop.
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
BACKUP_DIR='_backup'; | |
FILE_LIST=`find . -type f -not -path "*$BACKUP_DIR*"` | |
mkdir -pv $BACKUP_DIR; | |
while IFS= read -r line | |
do | |
if [[ $line == *"$1"* ]]; then | |
newfile=`echo $line | sed "s%$1%$2%g"`; | |
mkdir -pv "`dirname "$newfile"`"; | |
echo "Copying $line to $newfile"; | |
cp "$line" "$newfile" 2> /dev/null; | |
mv "$line" $BACKUP_DIR 2> /dev/null; | |
fi; | |
list='\.png \.ttf'; | |
if ! [[ " $list " =~ " $line " ]] ; then | |
LC_ALL=C sed -i '' "s%$1%$2%g" "$line"; | |
fi | |
if [[ " $list " =~ " $line " ]] ; then | |
echo "$line matches $list"; | |
fi | |
done <<< "$FILE_LIST"; | |
#while IFS= read -r line | |
#do | |
# rm -rf $line; | |
#done <<< "$FILE_LIST"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment