Re: how to rename multiple files
On Mon, Dec 09, 2002 at 04:29:37PM -0500, drew cohan wrote:
> On Mon, Dec 09, 2002 at 03:03:10PM -0500, drew cohan wrote:
> > How do I rename all files in a directory matching the pattern *.JPG to
> > *.jpg in a bash shell script? Thanks to you guys I can check for the
> > existence of jpgs in a directory, but can't seem get 'mv' to rename
> > them for me (always complains that the last argument must be a
> > directory).
> Thanks, once again, you guys are great. One quick question about this
> $ rename 's/\.JPG$/.jpg/' *.JPG
> Shouldn't I literalize the second period like
> $ rename 's/\.JPG$/\.jpg/' *.JPG
> or doesn't that make a difference?
You only need to escape metacharacters on the left-hand side of s///
expressions, so no, it makes no difference.
Colin Watson [email@example.com]