I am trying to recursively rename files and folders with an icon without success, the files have been renamed correctly, but the folders will not.
What I use for files (works fine):
find . -name * -depth \ -exec bash -c 'mv "$1" "${1%/*}/$(iconv -f UTF8 -t ASCII//TRANSLIT <<< ${1##*/})"' -- {} \;
What I tried for files and folders (crash: only rename folders):
find . -exec bash -c 'mv "$1" "$(iconv -f UTF8 -t ASCII//TRANSLIT <<< $1)"' -- {} \;
ORIGINAL problem: I just want to rename a lot of files to make them "web friendly", thinks how to remove spaces, strange characters, etc., I currently have
find . -name '*' -depth \ | while read f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr -s ' ' _|tr -d "'"|tr -d ","|tr - _|tr "&" "y"|tr "@" "a")" ; done
Is there any way to make tr file higher and iconv in one go? because I say about 300,000 files to rename, I would like to avoid a second search, if possible.
If necessary, I work with Bash 4.2.24
Thanks in advance.
source share