We are running subversion on a Linux server. Someone in our organization overwrote about 3k files with mixed case when they need to all be lowercase.
This works in the CLI
rename 'y/A-Z/a-z/' *
But obviously will screw up subversion.
svn rename 'y/A-Z/a-z/' *
Doesn’t work because subversion deals with renames differently I guess. So How can I do this as a batch job? I suck with CLI, so please explain it like I’m your parents. hand renaming all 3k files is not a task I wish to undertake.
Thanks
Create a little script
svn-lowername.sh:Make sure to
chmod +x svn-lowername.sh. Then execute:How it works:
trto do character by character translations. (If you need to supportnon-ASCII letters, you’ll need to make a more elaborate mapping.)
svn rename. (You could use an if statement instead, but for one-linerconditionals using
||is pretty idiomatic.)You can use this for all files in a directory:
…or if you want to do it recursively:
If you think this problem might happen again, stash
svn-lowername.shin yourpath somewhere (
~/bin/might be a good spot) and you can then lose the./prefix when running it.