[NTLUG:Discuss] remove apostrophe from filenames
Robert Citek
robert.citek at gmail.com
Sun Jul 29 21:47:24 CDT 2007
On 07/29/2007 04:56 PM, 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.
Assuming you're using bash, here's a sample:
$ touch a "a'b" "a b"
$ ls -1
a
a b
a'b
$ find . -name "*'*"
./a'b
$ find . -name "*'*" | while read name ; do
mv "$name" "${name/\'/}"; done
$ ls -1
a
ab
a b
Regards,
- Robert
More information about the Discuss
mailing list