Renaming Files on Hoary
Serg Belokamen
serg.belokamen at gmail.com
Wed Jun 15 00:16:04 UTC 2005
for i in *.JPG; do mv ${i} `basename '.JPG' "${i}.jpg"`;done
or something like that...
On 15/06/05, Stephen R Laniel <steve at laniels.org> wrote:
> On Tue, Jun 14, 2005 at 11:19:10PM +0100, Tony Arnold wrote:
> > I was always amused to compare the verbosity of the above solution to
> > how it's done on OpenVMS, which is often accused of being verbose. The
> > equivalent would be:
> > rename [...]*.xxx .yyy
>
> Same with MS-DOS: you'd do rename *.JPG *.jpg. I'm a little
> unsure how you'd get the same feature in the various Unices,
> because the shell handles globbing. So before 'rename' had a
> chance to get at the list of files, 'rename *.JPG *.jpg'
> would have turned into
>
> rename a.JPG b.JPG c.JPG *.jpg
>
> And this would be no good. So at the very least you'd have
> to do
>
> rename '*.JPG' '*.jpg'
>
> to avoid shell interpretation. But then you're stuck, I
> think; you need your version of 'rename' to be able to parse
> '*.JPG' and figure out what to do with '*.jpg'.
>
> Which is why the Perl command
>
> rename 's/JPG/jpg/g' *.JPG
>
> is pretty nice. It's extremely powerful, and not that
> verbose.
>
> --
> Stephen R. Laniel
> steve at laniels.org
> +(617) 308-5571
> http://laniels.org/
> PGP key: http://laniels.org/slaniel.key
>
>
> BodyID:13220199.2.n.logpart (stored separately)
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> http://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
>
>
More information about the ubuntu-users
mailing list