LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 09-10-2003, 12:53 AM   #1
Jalalabee
Member
 
Registered: Aug 2003
Distribution: Slackware 10.2
Posts: 102

Rep: Reputation: 15
rename to lowercase


how can i rename an entire folder of files to all lowercase, without manually doing so?
 
Old 09-10-2003, 02:56 AM   #2
Bebo
Member
 
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 31
Maybe this'll help ya:

http://www.linuxquestions.org/questi...threadid=86913

 
Old 09-10-2003, 03:38 AM   #3
Jalalabee
Member
 
Registered: Aug 2003
Distribution: Slackware 10.2
Posts: 102

Original Poster
Rep: Reputation: 15
Heh.

Thanks for ze' reply-- ;-D

I'm having a problemo...I'm BRAND new to the whole scriptabobbin': heres thay log:

***START OF LOG***
jalal@computer:~/quake/ID1$ bash ~/noio
/home/jalal/noio: line 14:

#!/bin/bash

dir=/home/jalal/quake

for file in `ls $dir` ; do
# ANYCASE TO LOWERCASE:
newname=`echo $file | tr [A-Z [a-z]`

mv $dir/$file $dir/$newname
done

: No such file or directory
jalal@computer:~/quake/ID1$
***END OF LOG***

That is with the script at the link with the change for changing to lowercase and to a specified dir:

***START OF CODE***
'

#!/bin/bash

dir=/whatever/directory

for file in `ls $dir` ; do
# ANYCASE TO UPPERCASE:
newname=`echo $file | tr '[a-z]' '[A-Z]'`

mv $dir/$file $dir/$newname
done

'
***END OF CODE***

Also note that it does not rename the files to lowercase. :-)
 
Old 09-10-2003, 04:01 AM   #4
Bebo
Member
 
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 31
Hmm, I see one problem in the first script here; the character conversion line is missing a right bracket and some single qoutes. The line should be

newname=`echo $file | tr '[A-Z]' '[a-z]'`

Does that help? Also, instead of doing the "bash blah" at the prompt, it's easier to do (assuming the script file is "script" ) "chmod u+x script" and then run it with "./script".
 
Old 09-10-2003, 04:10 AM   #5
Jalalabee
Member
 
Registered: Aug 2003
Distribution: Slackware 10.2
Posts: 102

Original Poster
Rep: Reputation: 15
Zeeeing-

Thanks for the quick 'sponse! ;-D

Ah, yes, I made that correction before actually, I copied it from the post.

For ze' script easierness:

***START OF LOG***
jalal@computer:~$ rename noio noio.script
jalal@computer:~$ chmod u+x noio.script
chmod: getting attributes of `noio.script': No such file or directory
jalal@computer:~$
***END OF LOG***

Humina-
 
Old 09-10-2003, 04:23 AM   #6
Bebo
Member
 
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 31
Whaaat...? Where did the file go? Do an "ls" to see if the file is really there...
 
Old 09-10-2003, 04:44 AM   #7
Jalalabee
Member
 
Registered: Aug 2003
Distribution: Slackware 10.2
Posts: 102

Original Poster
Rep: Reputation: 15
off topic, but just reading this up and thought it might be amusing / interesting... http://www.synopsys.com/news/pubs/co...lan-mar03.html

anyway though...i did not successfully change the name... is "rename" the proper command for such?

but even if...shouldn't "bash ~/noio" work? noio being the name of the script of course...
 
Old 09-10-2003, 05:08 AM   #8
Bebo
Member
 
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 31
Well, it seems that there is a rename command, but what people use is "mv"; "mv oldfile newfile". I never use the "bash blah", but I think it works

That kind of research is really interesting, but what if the implants are proprietary? Pay $100 a month to get my arm to move the way I want... And what about crashes and reboots? The way things seem to go with the patents on genes - which is completely nuts - it wouldn't surprise me... Ah, sorry about the distopia, it was meant as a joke in the beginning, but I guess I got off track
 
Old 09-10-2003, 05:16 AM   #9
Jalalabee
Member
 
Registered: Aug 2003
Distribution: Slackware 10.2
Posts: 102

Original Poster
Rep: Reputation: 15
hah..yes, y2k bug too, O NOo00o!

Behhh...i dont have much experience btw...tried linux out a few different times on my main computer..but because of the lack of support for learning...i typed exit and dropped back to you know what, by you know who. HERES A SECRETTT btw, shhh, its free. ...but yea...any ideas with what could be wrong with it? many thanks again
 
Old 09-10-2003, 05:37 AM   #10
Bebo
Member
 
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 31
OK, the script I wrote isn't very good since it will change it's own name if it's in the wrong dir I really don't understand what's going wrong in your case, but anyway, here's how I would do it:

1) Open an editor, write the script, and save it in, for instance, my home dir, maybe as noio. Since the script is a bit bad, the dir variable has to be something other than the directory that the script is in.
2) Quit the editor, and issue "chmod u+x noio" at the terminal prompt.
3) Now it should be enough to do "./noio" at the prompt.

No?
 
Old 09-10-2003, 05:39 AM   #11
Bebo
Member
 
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 31
I'm sorry, I have to leave now, but I'll be back later. Good luck!
 
Old 09-10-2003, 11:44 AM   #12
Jalalabee
Member
 
Registered: Aug 2003
Distribution: Slackware 10.2
Posts: 102

Original Poster
Rep: Reputation: 15
ahhh...i had to leave myself...hah..and there was a special on 9/11 and the step by step process of why the buildings fell

ill check it all out and return to it

lates man,

thanks

jalal
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting Uppercase to Lowercase AMMullan Linux - Software 6 10-18-2005 07:32 PM
lowercase recursively cubax Linux - General 6 05-29-2005 04:20 PM
kernel image name not all in lowercase? fatman Debian 3 02-16-2005 01:51 AM
[c++]to lowercase hylke Programming 3 05-16-2004 01:24 AM
renaming to lowercase locazor Linux - Software 1 01-02-2004 08:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:26 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