LinuxQuestions.org
Help answer threads with 0 replies.
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 07-26-2004, 09:26 PM   #1
superztnt
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, 09:27 PM   #2
Lleb_KCir
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, 07:58 AM   #3
chakkerz
Member
 
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, 08:22 AM   #4
Gnuru
Member
 
Registered: Jan 2004
Posts: 53

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

Code:
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:

http://gnuru.org/index.pl?node_id=814
 
Old 07-27-2004, 08:29 AM   #5
Gnuru
Member
 
Registered: Jan 2004
Posts: 53

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

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


Reply


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


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration