Yeasterday I had to scim through my old drive wich prevoisly was something that 'Windows' called it's home for a long time.
I am using linux for a long time now and I don't have to tell you how unfriendly it is to cd into a directory containing many spaces and being half upper case or even all upper case... and those very long names... I thought that something has to be done about it. And I asked myself why couldn't Perl help me at it?
So I set down and wrote a simple script that could make those names more friendly to me. I added a few features and now I would like to ask You for a opinion.
Here is the --help from this script:
Usage: ./fixname.pl options target
target either a file or a directory
This script changes file names to more user friendly ones
Options:
-h, --help display this help screen
-V, --version display version information
-S, --sub-space=X substitute spaces in the file name with a spec
+ified char
acter
-s, --strip remove all spaces from the file name
-l, --lower transfer all upper case letters in the filenam
+e into low
er case letters
-u, --upper transfer all lower case letters in the filenam
+e into upp
er case letters
-v, --verbose give verbose informations use multiple times t
+o get even
more verbose output
-d, --dir-only only change directory names
-f, --file-only only change file names
-F, --force the script will change file names even if the
+destinatio
n name already exists
-t, --trim=X trims the filename to given length ( must be m
+ore than 0
length )
I have also started to write a .pod documentation for the script, my first one indeed so please fell free to criticise.
You can get both the script source and pod doc in tar.gz format from
http://kewlnet.int.pl/~karql/fixname.tar.gz
What are my concerns right now?
Well the most irritating thing is fat type drives, because FILE and file are treated the same so --lower and --upper function by themselv won't change the filename ( it seems to work if used with something that changes characters in the file or its lenght like --trim or --subspace )
I was wondering if You could point me in a direction to solve this problem.
Another thing is about the features, those implemented are beacuse I found them useful, I would like to know what is useful for the most of us, is this script even worth further development?
I was thinking on adding --regex to allow direct control over file changing, but the question is should I give control over the whole regexp and pass it as an eval ? or take only the args double-check them and pass it into my preset regular expression? Should I allow the regex to modifie the file extension ( if it exists ? ); or should I forget about implementing regexps at all ?
Also I am wondering about the code, how do you find it? Is it passable ? In the means of efficiency, and maybe style? If not on what parts should I focus?
There is a second reason for this post, I thougth that maybe someone will find this useful like I did.
I am sorry for my grammar mistakes as english is not my native language.