LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-10-2008, 06:32 PM   #1
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
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?
 
Old 02-10-2008, 08:34 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 02-11-2008, 08:56 AM   #3
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by Tinkster View Post
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 View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Grrr! vfat not respecting all uppercase filenames wonkocz Linux - Newbie 15 11-11-2010 12:37 PM
Puppy OS, vfat and all uppercase filenames wonkocz Puppy 1 10-08-2006 12:39 PM
samba replaces Uppercase char in filenames to lowercase srikz Other *NIX 3 03-03-2006 08:59 AM
Uppercase filenames showing in lowercase rvoigt Linux - General 1 02-20-2006 11:07 PM
copy files and make all filenames uppercase pas Linux - Newbie 1 12-19-2004 11:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration