I need to change the capitalization of a set of files in a subversion working copy, like so:
svn mv test.txt Test.txt svn mv test2.txt Test2.txt svn mv testn.txt Testn.txt ... svn commit -m "caps"
How can I automate this process? Standard linux install tools available.
ls | awk '{system("svn mv " $0 " " toupper(substr($0,1,1)) substr($0,2))}'
obviously, other scripting languages will work just as well. awk has the advantage that it it ubiquitous.
If you have a decent install you should have python, give this a try:
#!/usr/bin/python
from os import rename, listdir
path = "/path/to/folder"
try:
dirList = listdir(path)
except:
print 'There was an error while trying to access the directory: '+path
for name in dirList:
try:
rename(path+'\\'+name, path+'\\'+name.upper())
except:
print 'Process failed for file: '+name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With