[OOZY] Renaming more than 200 pics

OOzy Pal oozypal at gmail.com
Mon May 8 16:45:27 UTC 2006


On 5/8/06, Dave Carrigan <dave at rudedog.org> wrote:
> On Sunday 07 May 2006 11:58, OOzy Pal wrote:
>
> > Thank you; it worked. Now the names also contains "(" and ")"  for
> > example, a name of file is like:
> >  20051030-Layan-(2).jpg
> > as you can see the dashes is OK. Now, I want to remove "(" and ")"
> > because linux will also put a backslash b4 the "(". Moreover, if the
> > number is one digit I want to add a leading 0 so the name becomes
> > 20051030-Layan-02.jpg.
>
> To change spaces to dashes:
>
>   rename 's/ /-/g' *.jpg
>
> To change the (2) to -02:
>
>   rename 's/\((\d+)\)/sprintf("-%02d", $1)/e' *.jpg
>
> You could do it all in one line:
>
>   rename 's/ /-/g; s/\((\d+)\)/sprintf("-%02d", $1)/e' *.jpg
>
> Use rename -n if you want to see what will happen without it actually doing
> anything.
>
> p.s., Linux is not putting backslashes in the names. Your shell is doing that
> as a convenience for you when it does tab-completion.
>
> --
> Dave Carrigan
> Seattle, WA, USA
> dave at rudedog.org | http://www.rudedog.org/
> UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL-Postfix
>
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
>
>
>

Thank you. I also tried krename and works too.
Case closed :).

Thanks again.


--
OOzy




More information about the ubuntu-users mailing list