home products tech support contact us

 Linux 技術支援    ⇒   基礎篇    進階篇    補腦篇    指令索引    中⇒ENG
版權所有, 引用請註明出處
 

rename 檔案大量更名

如果要大量的檔案更名,且有規則可言,rename 是很好的工具,其基本用法為 rename [options] 's/string_to_replace/replacement_string/' files.. .其中〝s/string_to_replace/replacement_string/〞 是一個替換規則,它告訴 rename 命令要將文件名中匹配的部分替換為指定的字串。

例:
$ rename .c++ .cpp *.c++ ←將目錄內所有副檔名為〝.c++〞全改名為〝cpp〞
$ rename baidu yahoo * ←將檔名〝baidu〞改名為〝yahoo〞

更多 rename 範例和說明參考連結