View Full Version : [SOLVED] batch rename
phillw
May 15th, 2010, 06:46 PM
Hi,
an easy one for you good people used to shell scripts :)
I have files like B13800205154.eps.jpg that I want to rename to B13800.jpg
The good news is that the 'bit' I want to keep is the first 6 characters and they will all have .jpg at the end
Thanks,
Phill.
crjackson
May 15th, 2010, 08:02 PM
Not a shell command but I prefer to use Renamthemall. Have you checked it out?
ibuclaw
May 15th, 2010, 08:09 PM
rename -v 's/^(.{6}).*?(.jpg)$/$1$2/' *
crjackson
May 15th, 2010, 08:10 PM
rename -v 's/^(.{6}).*$/$1.jpg/' *
I could have never figured that out.. Don't even know what it means.
Paddy Landau
May 15th, 2010, 08:17 PM
Also try pyrenamer. It's in the repositories.
phillw
May 15th, 2010, 08:58 PM
rename -v 's/^(.{6}).*?(.jpg)$/$1$2/' *
Thanks, ibuclaw - I had spent some time reading the man page for rename - it may as well be in chinese :-)
Phill.
ibuclaw
May 15th, 2010, 10:07 PM
Thanks, ibuclaw - I had spent some time reading the man page for rename - it may as well be in chinese :-)
Phill.
It's better than chinese, it's PERL!!! :)
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.