Sanefile is a tool to easily and quickly clean and change a large number of filenames.
I had to find an efficient way of changing a large number of filenames. Sanefile was the result. Simple, single-purpose and very efficient at it with total exploitation of Tcl’s rich Regular Expression capabilities.
What this tool is NOT: spy-ware, spam-ware, virus or any other crappy stuff.
With Sanefile, you can use the full power of regular expressions. For instance, imagine that you want to filter off all files starting with a A. To use the just A would remove from the list all the files with A in it. Not the solution. If you use ^A (Carat and A) it means that it has to match A only at the beginning of the text.
^text matches "text" in the beginning of the name
text$ matches "text" in the END of the filename
. matches ANY character
[ ] range indicator as in:
[a-z] matches ONE letter "a" to "z"
[a-zA-Z] matches ONE letter "a" to "z" and "A" to "Z"
[0-9] matches ONE digit
[^range] (caret) matches if NOT in the range as in:
[^0-9] matches if it is NOT a digit
* operator for repetition
.* matches everything
[0-9]* multiple digits
[^a-zA-Z0-9]* a bunch of everything BUT a letter or digit
( when you want to match (
. when you want to match .
when you want to match (RARELY DONE! Think why.)
() used to group expressions
ab* a followed with multiple b's
(ab)* multiple ab (different from above!)
^Doors.*([A-Z][0-9]*).*.mp3$ Matches all files starting with Doors, have somewhere in the middle a letter followed by digits and end in ".mp3"