34 lines
1.7 KiB
Bash
Executable File
34 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
SAVEIFS=$IFS
|
|
export IFS=$'\n';
|
|
CDIR=$(pwd)
|
|
|
|
echo "Recursive - Are you sure? CTRL-C now to terminate."
|
|
sleep 4
|
|
|
|
for i in `find $CDIR -type d -print`; do
|
|
DIR=$i
|
|
cd "$DIR"
|
|
echo echo "In $DIR"
|
|
find . -maxdepth 1 -type f \( -iname "* *" \) -exec bash -c 'mv -n "$0" "${0//\ /_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*-*" \) -exec bash -c 'mv -n "$0" "${0//\-/_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*+*" \) -exec bash -c 'mv -n "$0" "${0//\+/_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*,*" \) -exec bash -c 'mv -n "$0" "${0//\,/_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*\!*" \) -exec bash -c 'mv -n "$0" "${0//\!/_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*\'*" \) -exec bash -c 'mv -n "$0" "${0//\'"'"'/_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*#*" \) -exec bash -c 'mv -n "$0" "${0//#/_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*;*" \) -exec bash -c 'mv -n "$0" "${0//;/_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*&*" \) -exec bash -c 'mv -n "$0" "${0//&/_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*\[*" \) -exec bash -c 'mv -n "$0" "${0//\[/_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*]*" \) -exec bash -c 'mv -n "$0" "${0//\]/_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*(*" \) -exec bash -c 'mv -n "$0" "${0//\(/_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*)*" \) -exec bash -c 'mv -n "$0" "${0//\)/_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*___*" \) -exec bash -c 'mv -n "$0" "${0//___/_}"' {} \;
|
|
find . -maxdepth 1 -type f \( -iname "*__*" \) -exec bash -c 'mv -n "$0" "${0//__/_}"' {} \;
|
|
for f in `find . -maxdepth 1 -type f` ; do mv -v $f `echo $f | tr '[A-Z]' '[a-z]'` ; done
|
|
cd "$CDIR"
|
|
done
|
|
|
|
IFS=$SAVEIFS
|