Hello there, I have a quick question. Is there a way to change one letter in a few hundred filenames in the same directory? The setup script is looking for lowercase letters but on the cd everything is in capitol letters. I have already renamed the few names that had ordinary names there is a huge number of files beginning with F followed by a number. I`d like to automaticaly change all of these to f. Wich brings me to the idea that it would be enough to just change every cappitol to low case......hmmmmm anny ideas??? greets Cat -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
mmv will do what you want, but it's such a peculiar tool I'd probably try doing it with Perl first!
Is there a way to change one letter in a few hundred filenames in the same directory? The setup script is looking for lowercase letters but on the cd everything is in capitol letters. I have already renamed the few names that had ordinary names there is a huge number of files beginning with F followed by a number. I`d like to automaticaly change all of these to f.
Wich brings me to the idea that it would be enough to just change every cappitol to low case......hmmmmm anny ideas???
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
If you're in bash, the following would do what you want for i in *; do mv $i `perl -e "print lc \$i"`; done if you weren't trying to rename files that live on a CD. That won't work here unless you copy all the files on the CD to your hard disk. You might be able to alter the setup script to do the translation internally. (Is it a shell script, or perl, or...?) -tara On Mon, 8 May 2000, catsquotl wrote:
Hello there,
I have a quick question. Is there a way to change one letter in a few hundred filenames in the same directory? The setup script is looking for lowercase letters but on the cd everything is in capitol letters. I have already renamed the few names that had ordinary names there is a huge number of files beginning with F followed by a number. I`d like to automaticaly change all of these to f.
Wich brings me to the idea that it would be enough to just change every cappitol to low case......hmmmmm anny ideas???
greets Cat
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
T L Andrews wrote:
If you're in bash, the following would do what you want
for i in *; do mv $i `perl -e "print lc \$i"`; done
Hello -tara, I tried your script ,but it gives the following messages after each file. bash: perl-e print lc <filename> :command not found mv: missing file argument As i don`t know annything about perl could you help me out please. Thanks a lot Cat -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
catsquotl wrote:
T L Andrews wrote:
If you're in bash, the following would do what you want
for i in *; do mv $i `perl -e "print lc \$i"`; done
Hello -tara, I tried your script ,but it gives the following messages after each file.
bash: perl-e print lc <filename> :command not found mv: missing file argument
Seems like you've ommited a relevant space between perl and -e argument. BTW, as far i've read this thread, the original message sais anything about a CD, that's a read-only filesystem so 'mv' command will not work, perhaps the better solution is to do simbolic links to the files in any temporal directory as follows: mkdir /usr/tmp/downcase-cd move into the CD directory in which the bad upcase named files are and then for i in *; do ln -s $i `perl -e "print lc /usr/tmp/downcase/\$i"`; done hope sintax is ok Have a good one.
As i don`t know annything about perl could you help me out please. Thanks a lot Cat
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
-- Francisco M. Marzoa Alonso Nuevo Mundo - Dpto. Informático ICQ#: 62850923 Henri Dunant, 19 - 28036 Madrid tfno: +34 91 343 18 40 ext. 207 España / Spain fax: +34 91 350 28 45 -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
If you're in bash, the following would do what you want
for i in *; do mv $i `perl -e "print lc \$i"`; done
Hello -tara, I tried your script ,but it gives the following messages after each file.
bash: perl-e print lc <filename> :command not found mv: missing file argument
There should be a space between the 'perl' and the '-e'. -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
catsquotl wrote:
T L Andrews wrote:
If you're in bash, the following would do what you want
for i in *; do mv $i `perl -e "print lc \$i"`; done
I tried your script ,but it gives the following messages after each file.
bash: perl-e print lc <filename> :command not found mv: missing file argument
As i don`t know annything about perl could you help me out please.
First of all, make sure you've got a space between the 'perl' and the '-e'. If you do, then this message could be caused by you not having perl installed. In this case you'll need to install it - it's in package 'perl', series 'a' (although since it's one of the base system packages, it should be installed by default...). Hope that helps, Chris -- __ _ -o)/ / (_)__ __ ____ __ Chris Reeves /\\ /__/ / _ \/ // /\ \/ / ICQ# 22219005 _\_v __/_/_//_/\_,_/ /_/\_\ -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
Thanks everyone for yer help. The space between perl and -e did some of it however mv is still missing a file argument. I copied all files to my hard disk and did a chmod755 to all of them in order to have the propper permissions. happy greets Cat -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
Hi, On Mon, May 08 2000 at 14:19 +0200, catsquotl wrote:
The space between perl and -e did some of it however mv is still missing a file argument.
Do you have perl intalled? If you don't, use for i in *; do mv "$i" "`echo "$i" |tr "[:upper:]" "[:lower:]"`"; done (yes, lots of double quotes but they are necessary so the whole thing doesn't choke on file names with spaces). If your too lazy to type that mmv "*" "#l1" will work as well (plus it will happily rename file names with newlines). Ciao, Stefan -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
catsquotl wrote:
. The space between perl and -e did some of it however mv is still missing a file argument.
OK then. I've put a short script at the bottom of this message that will do what you want - it's not as short and sweet as other solutions, but it does the job. Just save it and make it executable, then call it with the directory which contains the files you want to rename as an arguement, for example: lowerren /home/chris/test to rename the files in /home/chris/test after saving the script as lowerren. Note that this will rename *all* files to *completely* lowercase, not just ones beginning with 'F'.
I copied all files to my hard disk and did a chmod755 to all of them in order to have the propper permissions.
Hope this is useful, Chris --- script starts here --- #!/usr/bin/perl if ($ARGV[0] ne "") { # If a directory is specified, use that $rendir = $ARGV[0]; if ($rendir !~ /\/$/) { # If there's no trailing slash $rendir = $rendir . "/"; # put one in } } opendir (RENDIR, "$rendir") || die ("Cannot open directory $rendir\n"); print "Renaming files in $rendir to their lowercase equivalents.\n"; until (($file = readdir(RENDIR)) eq "") { $lfile = lc($file); if ($file ne $lfile) { print "Moving ", $file, " to ", $lfile, ".\n"; `mv $file $lfile`; } } closedir (RENDIR); --- script stops here --- -- __ _ -o)/ / (_)__ __ ____ __ Chris Reeves /\\ /__/ / _ \/ // /\ \/ / ICQ# 22219005 _\_v __/_/_//_/\_,_/ /_/\_\ -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
Thanks everyone for your input. It finaly worked with the mmv command Stefan suggested. Chris thanks for the script. There seem to be a few syntax errors. Good exersise for me to debug as i am going try to learn Perl soon so I won`t have to bother all of you with these questions. greets Cat -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
catsquotl wrote:
Thanks everyone for your input. It finaly worked with the mmv command Stefan suggested.
Chris thanks for the script. There seem to be a few syntax errors. Good exersise for me to debug as i am going try to learn Perl soon so I won`t have to bother all of you with these questions.
Hmmm. Works for me. Ah, I see what it is (after cutting and pasting from the email and then trying to run it) - the line wrapping in Netscape has put the end of the comment from one line onto the following line. These two lines should actually only be one line: if ($ARGV[0] ne "") { # If a directory is specified, use that The comment is unecessary, so you can just replace these 'two' lines with: if ($ARGV[0] ne "") { 'use' also happens to be a statement in Perl, which is what causes the huge long error message. I've also noticed that I missed a line out when I cut and pasted into Netsape, although it will still work if you specify the directory. Insert the following as the second line: $rendir = "./"; I'm glad you got it sorted anyway. I know you don't need this, but I thought I'd just correct it for the sake of completeness. In short, replace: #!/usr/bin/perl if ($ARGV[0] ne "") { # If a directory is specified, use that with: #!/usr/bin/perl $rendir = "./"; if ($ARGV[0] ne "") { Sorry about that, Chris P.S. Have fun learning Perl. -- __ _ -o)/ / (_)__ __ ____ __ Chris Reeves /\\ /__/ / _ \/ // /\ \/ / ICQ# 22219005 _\_v __/_/_//_/\_,_/ /_/\_\ -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
Hi, On Mon, May 08 2000 at 13:28 +0200, catsquotl wrote:
T L Andrews wrote:
If you're in bash, the following would do what you want
for i in *; do mv $i `perl -e "print lc \$i"`; done
[...] I tried your script ,but it gives the following messages after each file.
bash: perl-e print lc <filename> :command not found mv: missing file argument
Obviously you've missed a space between `perl' and `-e'. Ciao, Stefan -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
I have a quick question. Is there a way to change one letter in a few hundred filenames in the same directory?
catsquotl wrote: there is a thing called "portable file system(pfs)" dor cd's that you can option into doing it for you. don' t know though,where and if it is availabe for linux. well, my .02. regards dan -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
?? Kfilereplace On Mon, 08 May 2000, you wrote:
Hello there,
I have a quick question. Is there a way to change one letter in a few hundred filenames in the same directory? The setup script is looking for lowercase letters but on the cd everything is in capitol letters. I have already renamed the few names that had ordinary names there is a huge number of files beginning with F followed by a number. I`d like to automaticaly change all of these to f.
Wich brings me to the idea that it would be enough to just change every cappitol to low case......hmmmmm anny ideas???
greets Cat
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
participants (8)
-
catsquotl@softhome.net
-
chris.reeves@iname.com
-
fgs@epulse.net
-
fmmarzoa@idecnet.com
-
fountai@hursley.ibm.com
-
stefan.troeger@wirtschaft.tu-chemnitz.de
-
suse@dertext.de
-
tla@akamai.com