How can I batch rename files using the Terminal?

后端 未结 10 1739
情歌与酒
情歌与酒 2020-12-12 17:43

I have a set of files, all of them nnn.MP4.mov. How could I rename them so that it is just nnn.mov?

10条回答
  •  失恋的感觉
    2020-12-12 18:27

    To test print the operation:

    for file in *.MP4.mov; do j=`echo $file | cut -d . -f 1`;j=$j".mov";echo mv \"$file\" \"$j\"; done
    

    To make it work:

    for file in *.MP4.mov; do j=`echo $file | cut -d . -f 1`;j=$j".mov";mv "$file" "$j"; done
    

提交回复
热议问题