Tuesday, March 30, 2010

Sanename: Remove unusual characters from filenames

I was having a difficult time manipulating a lot of files my boss gave me yesterday with scripts in Linux because the files had spaces and other unusual characters in them. I finally wrote a small C program that recursively renames all files in the current directory and all subdirectories so that anything that isn’t ASCII, a letter, a number, or one of the _-. characters in a filename is converted in to a _ character.

Note that this program is dangerous and you shouldn’t use it unless you know what you’re doing.

It can be looked at here:


I do not support this program and it comes with no warranty.