bash - unix: renaming batch of files - how do I add numbers from 1 to 4000 to the filenames of 4000 files? -


i have 4000 files, , need add nrs 1 4000 @ beginning of filenames.

for example:

file_a.cel file_c.cel file_g.cel file_x.cel ... other_file.cel 

should become:

1_file_a.cel 2_file_c.cel 3_file_g.cel 4_file_x.cel ... 4000_other_file.cel 

it important underscore after number gets added. filenames totally different (there no system filenames), , doesn't matter in order numbered. there easy way using bash? many in advance!

using afor loop , mv should give desired effect. it's not particularly interesting solution, it's simple.

count=1 file in ./*;     mv "$file" "${count}_$file"     let count++ done 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -