How can I easily bulk rename files with Perl?

后端 未结 9 1102
一生所求
一生所求 2021-01-05 17:25

I have a lot of files I\'m trying to rename, I tried to make a regular expression to match them, but even that I got stuck on the files are named like:

<
9条回答
  •  有刺的猬
    2021-01-05 17:45

    if your remote has bash shell

    for i in File*; 
    do 
        case "${i##* }" in  [0-9][0-9] ) 
          echo  mv "$i" "${i% *} $(printf "%03d" ${i##* })" ;; 
        esac; 
    done
    

    remove "echo" to do actual renaming

提交回复
热议问题