Filename with a apostrophe / single quote in its file name can cause a lot of problems when used with a bash script or used on a command line. The following command will remove all apostrophes from all files located in a current working directory:

for f in *; do mv "$f" `echo $f | sed 's/\x27//g'`; done

If you with to replace a apostrophe with X you can use a following command:

for f in *; do mv "$f" `echo $f | sed 's/\x27/X/g'`; done


Free Linux eBooks

Go to top