Linux專業更名工具rename使用

Linux專業更名工具rename使用

WARNING(注意⚠️)

The renaming has no safeguards.  If the user has permission to rewrite file names,  the  command  will
perform  the action without any questions.  For example, the result can be quite drastic when the com‐
mand is run as root in the /lib directory.  Always make a backup before running  the  command,  unless
you truly know what you are doing.

語法格式

rename [options] expression replacement file.. 即:
rename 原字符串 新字符串 文件名

rename 實戰

批量更改文件的後綴名,如下:

批量創建實驗用文件

# touch {test1.txt,test2.txt,test3.txt}
# ll
總用量 0
-rw-r--r-- 1 root root 0 10月 30 16:58 test1.txt
-rw-r--r-- 1 root root 0 10月 30 16:58 test2.txt
-rw-r--r-- 1 root root 0 10月 30 16:58 test3.txt

批量更改文件後綴名

# rename "txt" "gif" *.txt
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章