Change file names with find and iconv

后端 未结 3 1125
天命终不由人
天命终不由人 2021-01-13 12:30

I\'ve tried to change filenames using following script:

find dir/ -type f -exec mv {} $(echo {} | iconv -f UTF8 -t ASCII//TRANSLIT ) \\;

Why doesn\'t it work

3条回答
  •  误落风尘
    2021-01-13 13:06

    This should also work:

    #!/bin/bash
    if [ "$1" = "DO" ] ; then
     if [ "$2" != "$3" ]; then
      mv "$2" "$3";
     fi
    else
     find dir/ -type f -exec "bash" $0 "DO" {} $(echo {} | iconv -f UTF8 -t ASCII//TRANSLIT )  \;
    fi
    

提交回复
热议问题