find and replace

Ariel Gold arielqgold at gmail.com
Mon Feb 20 18:05:18 MST 2012


Here's one way to do it:

for f in *JPG ; do mv $f `basename $f JPG`jpg; done





On Mon, Feb 20, 2012 at 5:54 PM, Michael Havens <bmike1 at gmail.com> wrote:

> I'm trying to rename some files that have the extension JPG to jpg.
>
> First thing I did was:
>
> bmike1 at Michaels-Laptop ~/Pictures/2004 $ mv *JPG *jpg
> mv: target `rosebud1.mod.jpg' is not a directory
>
> huh? i want to move file x to file y! who said anything about a directory?
>
> looked at the man page and tried it with  the T option:
>
> bmike1 at Michaels-Laptop ~/Pictures/2004 $ mv -T *JPG *jpg
> mv: extra operand `100_0046.JPG'
>
> on the advice of others I tried:
>
> bmike1 at Michaels-Laptop ~/Pictures/2004 $ rename JPG jpg *JPG
> Bareword "JPG" not allowed while "strict subs" in use at (eval 1) line 1.
>
> I tried
>
> bmike1 at Michaels-Laptop ~/Pictures/2004 $ find *.JPG -exec rename .JPG
> .jpg {} \;
> syntax error at (eval 1) line 1, near "." <95 times>
> bmike1 at Michaels-Laptop ~/Pictures/2004 $
>
> and a few others. Why isn't mv moving a file name to another file name?
> --
> :-)~MIKE~(-:
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20120220/7753ad5a/attachment.html>


More information about the PLUG-discuss mailing list