[wellylug] Odd characters in filenames
michael at diaspora.gen.nz
michael at diaspora.gen.nz
Sat Jun 21 23:26:45 NZST 2003
Jamie Dobbs writes:
>I have just noticed that I have series of files that I want to copy from
>an NFS shared to my PC that have a '%' sign somewhere in their filename
>(eg apex011a%25.jpg). This appears to be causing some problems and I
>wonder if there is any easy way to remove the symbol/rename the
>offending files.
Assuming you're using bash, or at least not a csh type shell, and you
just want to remove the % from files in the current working directory:
ls *%* | \
while read file ; \
do \
new_file=$(echo $file | sed 's/%//g') ; \
echo mv $file $new_file ; \
done
Take out the 'echo' when you're sure it does what you want.
-- michael.
More information about the wellylug
mailing list