Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 07-26-2004, 08:26 PM   #1
LQ Newbie
Registered: Jun 2004
Location: Iowa
Distribution: Suse 9.0, Fedora Core 2
Posts: 18

Rep: Reputation: 0
How to change a mass of filename in a dir?

I have a folder with a lot of files in it and they have all capital letters in their names. I want to change all the capital letters to lower case letters on these file names. For example:

C06_038.HTM changed to c06_038.htm

How can I do this without renaming each file individually? I was hoping that there was something I could use to do it with a command or two.
Old 07-26-2004, 08:27 PM   #2
Senior Member
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Rep: Reputation: 45
i would reserch the man page for mv, but you might find this will work.

mv *.HTM *.htm

that should move any file with a HTM extention and rename them all to what ever.htm

im not 100% on that so i would check the man page first, but i would think that should do the trick.
Old 07-27-2004, 06:58 AM   #3
Registered: Dec 2002
Location: Brisbane, Australia
Distribution: RedHat (RHEL, FC, CentOS), openSuSE, Mac OS X
Posts: 653

Rep: Reputation: 32
man rename
Old 07-27-2004, 07:22 AM   #4
Registered: Jan 2004
Posts: 53

Rep: Reputation: 15
The easiest way to do this appears to be a perl one-liner:

perl -MFile::Copy -e 'move $_, lc($_) foreach glob "*"'
The above operates on all files in the working directory to which you have to cd first.

There is a bash script that does the same thing here:
Old 07-27-2004, 07:29 AM   #5
Registered: Jan 2004
Posts: 53

Rep: Reputation: 15
That's true, rename is better. Just cd to the working directory and do this:

rename 'y/A-Z/a-z/' *


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
change uploaded files from filename.avi to filename.avi.html like latheesan Linux - Newbie 3 06-16-2005 04:33 AM
Bash script to change a filename associated with an inode index number. Ziv Programming 22 06-19-2004 08:41 AM
Script to change several filename jan_81 Linux - Newbie 5 04-28-2004 11:10 AM
Can't change filename with SMB share InEeDhElPlInUx Linux - Security 0 04-01-2004 07:08 AM
change dir alaios Linux - General 5 03-15-2004 05:41 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:37 AM.

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