CLI: detox - Clean up filenames

The detox utility renames files to make them easier to work with.
It removes spaces and other such annoyances.

For example, if you have a file named “Favorite Cat Video.mp4” and want to use mplayer to watch it, because of the empty spaces, mplayer can’t play it. You have to “fill-in” the empty spaces in the file name. “Favorite_Cat_Video.mp4”

So, rather than fixing the problem by manually renaming all the file names, detox will fix the problem.

Another example: leafpad ~/Christmas/shopping list.txt
- it won’t open
keith@box ~ $ detox ~/Christmas
- now it will open because detox filled in the empty space: shopping_list.txt


pamac install detox


If you want to detox EVERYTHING in a directory, just run detox with the -r flag.

Example: keith@box ~ $ detox -r ~/Music

All directories and ALL files in the directories will be “fixed”.


Without the -r flag, it will only detox the directory, not the contents.


keith@box ~ $ ls ~/Music
Pink Floyd - Animals
keith@box ~ $

keith@box ~ $ detox ~/Music

keith@box:~$ ls ~/Music
keith@box ~ $

Now you can look inside the folder and see NONE of the files were detoxed.

keith@box ~ $ ls -1 ~/Music/Pink_Floyd-Animals
01 - Pink Floyd - Pigs On The Wing (Part One).mp3
02 - Pink Floyd - Dogs.mp3
03 - Pink Floyd - Pigs (Three Different Ones).mp3
04 - Pink Floyd - Sheep.mp3
05 - Pink Floyd - Pigs On The Wing (Part Two).mp3
keith@box ~ $

If you only want to detox the contents of ONE directory, you can run detox without the -r flag

keith@box ~ $ detox ~/Music/Pink_Floyd-Animals

keith@box ~ $ ls -1 ~/Music/Pink_Floyd-Animals
keith@box ~ $


keith@box ~ $ detox -h
usage: detox [-hLnrvV] [-f configfile] [-s sequence] [–dry-run] [–inline] [–special]
file [file …]

-f configfile	choose which config file to use
-h --help	this message
--inline	run inline mode
-L		list available sequences and exit
		with -v ... dump sequence contents
-n --dry-run	do a dry run (don't actually do anything)
-r 		be recursive (descend into subdirectories)
--remove-trailing (deprecated)
		remove trailing _ and - before a period
-s sequence	choose which sequence to detox with
--special	work on links and special files
-v 		be verbose
-V 		show the current version

keith@box ~ $