[X-Unix] Renaming files with spaces

Charles Howse chowse at charter.net
Thu May 14 07:26:19 PDT 2009


Hi,
I need to batch rename all files with extension .PDF to extension .pdf.
They may or may not have spaces in the filenames.

The following works ONLY if there are no spaces in the filename:

for f in *.PDF; do
	base=`basename $f .PDF`
	mv $f $base.pdf
done

Can anyone provide a tip to something that will work regardless of  
whether there are spaces in the filenames or not?


--
Thanks,
Charles

Signs you're getting old...
A $4.00 bottle of wine is no longer "pretty good stuff".



More information about the X-Unix mailing list