Wednesday, January 6, 2010

Removing invalid/encoded characters from filenames

If you see the following output in your file system:
drwxrwxrwx 2 www-data www-data 4096 Jan  5 03:30 ?????? - ?Q?U?H-?X?Y??Like?t???
drwxrwxrwx 2 www-data www-data 4096 Jan  5 03:41 ???O?? ?@?????j?t???
It'll be difficult to work with the files.  By using "detox", you can remove all invalid characters from the files/folders.  In Ubuntu, simply perform the following command to install it:
# apt-get install detox
Then, do this:
# detox *Like*
If you like, perform a trial/dry run first by adding the --dry-run option.  Here's the output of the cleaned up folder name:
drwxrwxrwx 2 www-data www-data 4096 Jan  6 09:09 e_N-Q_U_H-yen_XAY_N_Like_t_U_

No comments: