• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

change name to uppercase

Can someone help me to change all filenames in a directory to uppercase? Right now there are various case used (files came off a windows machine). I need to change both the name and the extension to uppercase.

I am using redhat 9 OS.

Thanks in advance.
0
James Stone
Asked:
James Stone
  • 2
1 Solution
 
TintinCommented:
A generic way (you can use bash builtins to be more efficient) is:

for file in /some/dir/*
do
  mv $file `echo $file | tr [a-z] [A-Z]`
done
0
 
TintinCommented:
Whoops, should do a:

cd /some/dir

for file in *
do
   mv $file `echo $file | tr [a-z] [A-Z]`
done


The first version would have attempted to uppercase the dirs as well.
0
 
James Stonewarehouse managerAuthor Commented:
Thank you! Worked great.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now