我想在我的Linux系統目錄重命名多個文件....如何使用字符串替換來重命名linux中某個目錄中的所有文件?
我的文件名如:
Lec 1 - xxx.webm
Lec 2 - xxx.webm
Lec 3 - xxx.webm
Lec 4 - xxx.webm
和這樣的例子不勝枚舉...
這裏XXX可能是字符(不一致)的任何名單....
我想每個文件在這裏重新命名,如:
mv Lec 1 - xxx.webm Lec 1.webm
mv Lec 2 - xxx.webm Lec 2.webm
mv Lec 3 - xxx.webm Lec 3.webm
等等......
for循環可以做但如何做替換?
*去除所有字符後的數字應該是我的重命名的文件
文件名改爲'LEC N - webm.webm' – coolstoner
無'$ {F/- * /}'將在原始字符串的「」 - 「'後刪除所有內容,然後將添加」.webm「。 – anubhava
現在我所有的文件都被重新命名爲'Lec n.webm.webm' 你能幫我重新命名爲'Lec n.webm'嗎? 我試過這個鏈接,但我得到錯誤 http://unix.stackexchange.com/questions/102647/how-to-rename-multiple-files-in-single-command-or-script-in-unix – coolstoner