Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 421  / 1 Year ago, sun, february 19, 2023, 12:58:10

I have a list of folders video_0001 video_0002 video_0003 ...
How do I rename them all to 0001 0002 0003 ... ? I tried


mv video_{0001..0003} {0001..0003} but it does not work


More From » rename

 Answers
6

You can do it in a for loop by starting at the 7th character of each file (remember counting starts at 0) and saving the last 4 characters of each file.


for f in video_*; do mv $f ${f:6:4}; done

[#2306] Monday, February 20, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
berlorful

Total Points: 346
Total Questions: 90
Total Answers: 99

Location: Monaco
Member since Tue, Nov 30, 2021
3 Years ago
;