jx 发帖数: 16 | 1 A simple question: say I have a series of files with naming file 000,
file001, file 002 ... file 200, how do I easily change their names to
file001, file002, file003 ... file 201?
Thanks! | jx 发帖数: 16 | 2 sorry, there is no space between 'file' and the numbers. I just want to add
1 to each file name. | jx 发帖数: 16 | 3 sorry, there is no space between 'file' and the numbers. I just want to add
1 to each file name. | m*****l 发帖数: 55 | 4 mv oldfilename newfilename | c******l 发帖数: 36 | 5 one pipe line:
command ls file??? | sort -r |
perl -lpe 's/file(\d\d\d)/sprintf("mv $_ file%03d",$1+1)/e' | sh
(not fully tested)
【在 jx 的大作中提到】 : A simple question: say I have a series of files with naming file 000, : file001, file 002 ... file 200, how do I easily change their names to : file001, file002, file003 ... file 201? : Thanks!
| Z****e 发帖数: 2999 | 6 shell only... haha ;)
【在 c******l 的大作中提到】 : one pipe line: : command ls file??? | sort -r | : perl -lpe 's/file(\d\d\d)/sprintf("mv $_ file%03d",$1+1)/e' | sh : (not fully tested)
| g****s 发帖数: 181 | 7 man rename
for example,
rename 's/1$/2/' *1
This will rename file001,file011 to file002,file012. | t*****g 发帖数: 1275 | 8 for ((i=201;i>=1;i--)); do cmd=`printf "mv file%03d file%03d" $(($i-1)) $i`; eval $cmd; done
【在 jx 的大作中提到】 : A simple question: say I have a series of files with naming file 000, : file001, file 002 ... file 200, how do I easily change their names to : file001, file002, file003 ... file 201? : Thanks!
|
|