0

Using SSH how can I find sub-directories that begin with uppercase letters within a directory and then rename them, including merging if the lowercase named directory already exists?

e.g. if there is a directory called "Small" and a directory called "small" everything needs to be moved from "Small" to "small" overwriting any existing files. However if there is no directory called "small" then "Small" merely needs to be renamed to "small".

At the very least I would like to be able to just search for directories that start with uppercase letters, the renaming I could do manually afterwards.

John Mellor
  • 300
  • 1
  • 3
  • 9

1 Answers1

3

I would write a script with these tools utilized:

  • find -regex {you_will_write_the_regex} -type d ...
  • awk "to_lowercase"
  • mv {from_capital} {to_lowercase}

And run them like: http://www.cyberciti.biz/faq/unix-linux-execute-command-using-ssh/

Pipe them all! ;)

David Lakatos
  • 303
  • 1
  • 10