LinuxQuestions.org
Review your favorite Linux distribution.
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 04-27-2006, 04:39 PM   #1
nicdee
LQ Newbie
 
Registered: Jul 2005
Location: Massachusetts
Distribution: kubuntu 5.10
Posts: 28

Rep: Reputation: 15
Unhappy the rename bash command is malfunctioning


Hello,

I've had this problem for quite some time now and finally decided to ask about it. Whenever I save a certain file or transfer pictures from my digital camera to my computer, I prefer to rename all the files with lowercase letters and underscores instead of spaces and dashes.

I use:
Code:
rename 'y/A-Z/a-z/*'
and
Code:
rename 'y/-/_/*'
etcetera.

When I hit return, the shell looks like it is doing the job in the way that it goes "blank" until it finishes.. but the problem is.. it doesn't finish and doesn't respond to any other commands if I try to enter them (ie: exit). I end up having to physically close the shell window in order to make it go away, and when I go back into the directory which has the files i wish to rename, nothing has changed.

My guess is this is some type of bug, but I have no idea how to go about it or what to do next.

Has anyone else had this problem??


Please help! Manually renaming hundreds of files using the GUI is very tedious, time consuming and annoying, and therefore I refuse to attempt it!

Thank you very much in advance!

Last edited by nicdee; 04-27-2006 at 04:40 PM.
 
Old 04-27-2006, 06:19 PM   #2
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
Isn't "rename" a Perl function, and not a bash one?

If this is the same rename, you need to separate the file list ('*') from the operation:
Code:
rename 'y/A-Z/a-z/' *
rename 'y/-/_/' *
 
Old 04-27-2006, 07:29 PM   #3
zytsef
Member
 
Registered: Apr 2006
Location: Vancouver, Canada
Distribution: Slackware, Ubuntu
Posts: 168

Rep: Reputation: 30
try using the 'mv' command:
Code:
mv /path/to/dir/or/file /new/name/of/dir/or/file
 
Old 04-27-2006, 07:49 PM   #4
nicdee
LQ Newbie
 
Registered: Jul 2005
Location: Massachusetts
Distribution: kubuntu 5.10
Posts: 28

Original Poster
Rep: Reputation: 15
to ataraxia.

Wow i feel like an idiot lol. Thank you very much that's what I meant..

also. i pretty much don't know the difference between bash and perl commands. haha

thanks very much!
 
Old 04-27-2006, 07:57 PM   #5
slackmagic
Member
 
Registered: Aug 2003
Distribution: Slackware
Posts: 252

Rep: Reputation: 30
Quote:
Originally Posted by nicdee
to ataraxia.

Wow i feel like an idiot lol. Thank you very much that's what I meant..
no worries ataraxia.

I almost want to bet you 10 bucks you'll never forget the
Code:
mv
command anymore :P

learning things in and with linux is so great!
 
Old 04-27-2006, 08:10 PM   #6
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
Quote:
Originally Posted by retiredsoldier
no worries ataraxia.

I almost want to bet you 10 bucks you'll never forget the
Code:
mv
command anymore :P

learning things in and with linux is so great!
Me? What did I do?
 
Old 04-27-2006, 08:13 PM   #7
slackmagic
Member
 
Registered: Aug 2003
Distribution: Slackware
Posts: 252

Rep: Reputation: 30
ROFL,

I'm very sorry ataraxia.

this was totally meant for nicdee. I would have edited my own post to correct this, but now that you have posted, and you can't delete your own post, i'll just replied to this.

yeah..my post was meant for nicdee of course :P
 
Old 04-27-2006, 08:15 PM   #8
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
Quote:
Originally Posted by retiredsoldier
ROFL,

I'm very sorry ataraxia.

this was totally meant for nicdee. I would have edited my own post to correct this, but now that you have posted, and you can't delete your own post, i'll just replied to this.

yeah..my post was meant for nicdee of course :P
I thought so, but it was just too funny to ignore.

On a more serious note, plain "mv" wouldn't have been all that useful - the OP was doing a bulk renaming, for which the Perl "rename" function is, in fact, highly useful.
 
Old 04-28-2006, 05:23 AM   #9
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 52
This one is very usefull for wildcarded renaming
http://linux.maruhn.com/sec/mmv.html
 
Old 04-28-2006, 06:54 AM   #10
muha
Member
 
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 37
Or try:
Code:
rename '-' '_' *
 
Old 04-29-2006, 09:02 AM   #11
nicdee
LQ Newbie
 
Registered: Jul 2005
Location: Massachusetts
Distribution: kubuntu 5.10
Posts: 28

Original Poster
Rep: Reputation: 15
Cool

Thank you very much to all. All the help is useful.

I hope you all have a good day!

-nicole
 
  


Reply

Tags
rename


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
Bash - rename directory to overwrite existing LarsWestergren Linux - Newbie 18 04-04-2013 02:07 PM
Help with Bash Script - Rename Multiple Files embsupafly Programming 16 04-02-2010 03:50 AM
Bash - Batch File Rename Help... emailarron Linux - Newbie 4 01-26-2006 07:35 AM
BASH USAGE: mass files rename sirpelidor Linux - General 8 09-20-2005 12:36 AM
rename reboot command coco03 Linux - General 6 04-19-2005 02:11 AM


All times are GMT -5. The time now is 01:18 AM.

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