LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Convert filenames to uppercase (https://www.linuxquestions.org/questions/linux-general-1/convert-filenames-to-uppercase-620188/)

SlowCoder 02-10-2008 06:32 PM

Convert filenames to uppercase
 
I would like to recursively convert a series of files and directories within a specified directory to uppercase. What would be the best way to do this?

Tinkster 02-10-2008 08:34 PM

Why on earth would one want to? It's the other way round!

And that said:
scripting :}

Pseudocode:
Code:

use find to determine max-depth of directory levels.
for depth in `seq 1  maxdepth`
  for i in `find -type d -maxdepth depth -mindepth maxdepth  ` do
    new=(echo $i | tr '[a-z]' '[A-Z]')
    mv i new
  done
  for i in `find -type f -maxdepth maxdepth -mindepth maxdepth ` do
    new=(echo $i | tr '[a-z]' '[A-Z]')
    mv i new
  done
endloop


Cheers,
Tink

SlowCoder 02-11-2008 08:56 AM

Quote:

Originally Posted by Tinkster (Post 3052965)
Why on earth would one want to? It's the other way round!

I'm compiling a bunch of old DOSBox apps/games. When I am finished I want to convert everything to uppercase, just for authenticity's sake.

Quote:

Originally Posted by Tinkster (Post 3052965)
And that said:
scripting :}

Pseudocode:
Code:

use find to determine max-depth of directory levels.
for depth in `seq 1  maxdepth`
  for i in `find -type d -maxdepth depth -mindepth maxdepth  ` do
    new=(echo $i | tr '[a-z]' '[A-Z]')
    mv i new
  done
  for i in `find -type f -maxdepth maxdepth -mindepth maxdepth ` do
    new=(echo $i | tr '[a-z]' '[A-Z]')
    mv i new
  done
endloop


Cheers,
Tink

Thank you. I'll give it a shot.


All times are GMT -5. The time now is 09:11 AM.