Skip to main content

Thread: Change names of thousands of files


hi,
wife , come wonderful holiday. now, after placed pictures on computer, found out many names different other names. have no idea why camera did this.
have names img_0123 , have names _mg_0124. code can change names starting underscore name starting _mg_0124 becomes img_0124?
can me please? thank you.

before tell you, sure camera hasn't done reason. instance, there '_mg_1234' , 'img_1234'? if so, running command i'd suggest overwrite file named img_1234 file named _mg_1234. first, check files same number using following command (after cd in directory pictures of course)

ls | awk -f'mg_' '{print $2}' | sort | uniq -c | sort

print out list showing number of occurrences of given number. files share same number appear @ bottom of list, if last item on list starts number 1, go. example, if last line looks

1 1234

know there 1 file has 1234 in it. if, see

2 1234

know there both _mg_1234 , img_1234 , below command overwrite latter file. if case, let me know , can pull script work around it. if there few, can rename them manually.

out of way, here command. assuming of pictures in 1 directory, cd directory , run

rename _mg img *

yes, work run such simple command. have careful shell


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [ubuntu] Change names of thousands of files


Ubuntu

Comments

Popular posts from this blog

Joomla 3.3 Installation Error message - Joomla! Forum - community, help and support

Multilanguage infinite redirect loop error. - Joomla! Forum - community, help and support

trim media limit reached