LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-18-2004, 02:07 PM   #1
minm
Member
 
Registered: Jun 2003
Location: Canada
Distribution: suse 9.2
Posts: 582

Rep: Reputation: 30
string shell command?


What is the bash command to make everything in the directory (in the filenames) lowercase??

Also, is there a website with a bunch of these type of commands?

Thanks
 
Old 08-18-2004, 02:17 PM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Not bash spesific, but an easy way to do it:
Code:
rename 'y/A-Z/a-z/' *
 
Old 08-18-2004, 06:35 PM   #3
minm
Member
 
Registered: Jun 2003
Location: Canada
Distribution: suse 9.2
Posts: 582

Original Poster
Rep: Reputation: 30
is there a website where it displays all commands and their indepth help file to it?
 
Old 08-18-2004, 06:37 PM   #4
minm
Member
 
Registered: Jun 2003
Location: Canada
Distribution: suse 9.2
Posts: 582

Original Poster
Rep: Reputation: 30
hmm
i type rename 'y/A-Z/a-z/' *

and it doesn't return anyting, but it doesn't work
 
Old 08-18-2004, 06:39 PM   #5
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
http://www.tldp.org/LDP/Bash-Beginne...tml/index.html
and
http://www.tldp.org/LDP/abs/html/index.html
 
Old 08-18-2004, 06:44 PM   #6
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Works for me, it renames all files to lowercase.
 
Old 08-18-2004, 11:36 PM   #7
minm
Member
 
Registered: Jun 2003
Location: Canada
Distribution: suse 9.2
Posts: 582

Original Poster
Rep: Reputation: 30
hmm, anyone?
 
Old 08-18-2004, 11:45 PM   #8
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
ok, other way to do it:
Code:
for i in *; do mv $i `echo $i | tr A-Z a-z` ; done
 
Old 08-19-2004, 07:23 AM   #9
minm
Member
 
Registered: Jun 2003
Location: Canada
Distribution: suse 9.2
Posts: 582

Original Poster
Rep: Reputation: 30
hmm
i get this error :S

Quote:
mark@linux:~> for i in *; do mv $i `echo $i | tr A-Z a-z` ; done
mv: `abc.avi' and `abc.avi' are the same file
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
mv: when moving multiple files, last argument must be a directory
Try `mv --help' for more information.
 
Old 08-19-2004, 11:07 AM   #10
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
That is the correct output. Some files are just lowercase already. Rest of the files are now lowercase too.
 
Old 08-19-2004, 11:09 AM   #11
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
and oh.. you seem to have spaces in your files..
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
String in Bash Shell nguyenzoro Linux - Newbie 4 11-19-2005 05:49 PM
(shell script) string parsing kuru Programming 4 09-12-2005 08:59 PM
Shell script to find a particular string Prasun1 Linux - General 5 08-30-2005 10:23 AM
Removing Text from a Shell String OrangeLefty Programming 2 04-19-2004 12:08 AM
creating a unique id string in shell gumby Programming 4 05-07-2003 06:56 PM


All times are GMT -5. The time now is 12:28 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration