I'm posting another small script to rename files.
I'm working on files with spaces in their name (Oh! The Evil!) and I need to rename them to remove spaces and conver in camel-case.
At this time, I chose Python (version 3) to guarantee the script works also on Windows.
Just create a file called (for example) ToCameCase.py and past into it:
#!/usr/bin/env python3
import sys
import os
if len(sys.argv)<2:
print("Indicate the file pattern, please")
exit()
for filename in sys.argv:
name_tokens = filename.split(" ")
new_name=""
for token in name_tokens:
new_name+=token[0].upper()+token[1:]
os.rename(filename,new_name)
From the console call the script passing to it the file name o pattern to rename. For example
ToCameCase.py *.obj
it will convert the name of all the OBJ files in the directory.
Just a warn: it is very simple and only-for-my-usage oriented, so be careful if you use it: read the code and test it before use on your files!
