[NTLUG:Discuss] remove apostrophe from filenames

Chris Cox cjcox at acm.org
Sun Jul 29 21:48:28 CDT 2007


Mike LaPlante wrote:
> Can someone give me a quick script check for and remove apostrophes from 
> a ton of filenames. Doesn't have to be recursive, but won't hurt if it is.
> 
> I've been trying a very some simple "for" loops involving tr -d "'" but 
> I'm having trouble.
> 
>

cd directory-with-files-with-apostophes
find . -name "*'*" -print | while read filename; do
  newname=`echo "$filename" | sed "s/'//g"`
  mv "$filename" "$newname"
done



More information about the Discuss mailing list