mv命令既可以重命名,又可以移動文件或文件夾。但是實際應用中,它只能對單個文件重命名。
例子:
將目錄A重命名爲B
mv A B
將/a目錄移動到/b下,並重命名爲c
mv /a /b/c
mv配合for循環方式進行修改
[root@show day74]# for name in `ls *.html`;do echo $name ${name%.html}.jpg;done
00.html 00.jpg
01.html 01.jpg
02.html 02.jpg
03.html 03.jpg
04.html 04.jpg
05.html 05.jpg
06.html 06.jpg
07.html 07.jpg
08.html 08.jpg
09.html 09.jpg
10.html 10.jpg
[root@show day74]# for name in `ls *.html`;do mv $name ${name%.html}.jpg;done
[root@show day74]# ls
00.jpg 01.jpg 02.jpg 03.jpg 04.jpg 05.jpg 06.jpg 07.jpg 08.jpg 09.jpg 10.jpg
---------------------
作者:CL_Fighting
來源:CSDN
原文:https://blog.csdn.net/qq_21815981/article/details/80227601
版權聲明:本文爲博主原創文章,轉載請附上博文鏈接!