[X-Unix] Renaming files with spaces

Artifex Maximus artifexor at gmail.com
Sun May 24 12:48:38 PDT 2009


Hi!

On Thu, May 14, 2009 at 4:26 PM, Charles Howse <chowse at charter.net> wrote:
> I need to batch rename all files with extension .PDF to extension .pdf.
> They may or may not have spaces in the filenames.
Use find, read and quotation mark. Try this one:

find . -maxdepth 1 -type f -name *.PDF \
| while read i ; do
 base="`basename \"$i\" .PDF`"
 mv "$i" "$base.pdf"
done

Bye,
a


More information about the X-Unix mailing list