LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-11-2006, 11:26 AM   #1
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Rep: Reputation: 30
Unrenameable file?!


Hello, check this out, what am I doing wrong?

Code:
[zuki@nfs Moviez]$ ls
line-dozen2.avi  Rumor.Has.It.2005.DVDRip.xVID-LRC/
[zuki@nfs Moviez]$ rename line-dozen2.avi Cheaper.By.The.Dozen2.avi
[zuki@nfs Moviez]$ ls
line-dozen2.avi  Rumor.Has.It.2005.DVDRip.xVID-LRC/
 
Old 04-11-2006, 11:31 AM   #2
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 46
Try `mv` instead of `rename`.
 
Old 04-11-2006, 11:31 AM   #3
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
You are using the rename command, which is used to change substrings in file names.

What you want to do:

mv line-dozen2.avi Cheaper.By.The.Dozen2.avi

See:

man rename
man mv

Also:

apropos rename
 
Old 04-11-2006, 11:33 AM   #4
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Rep: Reputation: 162Reputation: 162
In linux, when you want to rename one file you use "mv"

Like this:

mv file1.txt file2.txt

file1.txt will be moved to file2.txt

Rename is used to rename groups of files and requires three arguments.
 
Old 04-11-2006, 11:33 AM   #5
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Original Poster
Rep: Reputation: 30
what?
why would I want to use MV which ment to MOVE files! and not rename which named to rename files?


EDIT : Thanks! it works
but lol! Rename should be able to rename file(s) without any difficulties!

Last edited by itz2000; 04-11-2006 at 11:35 AM.
 
Old 04-11-2006, 11:34 AM   #6
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 46
because it works that way in Linux?
 
Old 04-11-2006, 11:38 AM   #7
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Original Poster
Rep: Reputation: 30
haha... though I think rename should do this work aswell!

maybe someone will read this and compile this feature in the next kernel?
 
Old 04-11-2006, 11:38 AM   #8
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,540

Rep: Reputation: 878Reputation: 878Reputation: 878Reputation: 878Reputation: 878Reputation: 878Reputation: 878
Code:
~$ rename
Usage: rename [-v] [-n] [-f] perlexpr [filenames]
The first argument is a perl expression, the second one is a file. For what you are trying to do, mv is the right command.
For rename the correct arguments go like this:
Code:
rename 's/Cheaper.By.The.Dozen2.avi/line-dozen2.avi' line-dozen2.avi
rename is meant for renaming a whole bunch of files at once. As for moving rather than renaming, you can think of it as moving from /some/path/name1 to /some/path/name2. The fact that it is renaming is sort of a side effect. Furthermore mv is less typing than rename

Quote:
maybe someone will read this and compile this feature in the next kernel?
it's not part of the kernel...
 
  


Reply

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
forrtl: severe (47): write to READONLY file, unit 5, file /dev/pts/1 terrence Programming 1 10-01-2005 11:22 PM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 04:15 AM
nfs a file shares ok via file mngr but not command line. Suse 9.1 acummings Linux - Networking 2 10-09-2004 03:23 PM
Yum update complains missing file (broken dep), but file can be located. davidas Linux - Software 0 03-27-2004 10:11 PM
How to play a media file/ video file/mp3 file recorded in harddisk/cd-rom arindam Linux - Newbie 2 09-05-2003 11:31 AM


All times are GMT -5. The time now is 07:46 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration