[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to rename multiple files



    "drew" == drew cohan <debian@drewcohan.com> writes:

    drew> How do I rename all files in a directory matching the
    drew> pattern *.JPG to *.jpg in a bash shell script?  Thanks to
    drew> you guys I can check for the existence of jpgs in a
    drew> directory, but can't seem get 'mv' to rename them for me
    drew> (always complains that the last argument must be a
    drew> directory).

Still another way:

for i in *.JPG
do
  mv $i `basename $i .JPG`.jpg
done

Cheers!
Shyamal



Reply to: