LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Unrenameable file?! (https://www.linuxquestions.org/questions/linux-newbie-8/unrenameable-file-434099/)

itz2000 04-11-2006 10:26 AM

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/


uselpa 04-11-2006 10:31 AM

Try `mv` instead of `rename`.

macemoneta 04-11-2006 10:31 AM

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

AwesomeMachine 04-11-2006 10:33 AM

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.

itz2000 04-11-2006 10:33 AM

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!

uselpa 04-11-2006 10:34 AM

because it works that way in Linux?

itz2000 04-11-2006 10:38 AM

haha... though I think rename should do this work aswell!

maybe someone will read this and compile this feature in the next kernel?

ntubski 04-11-2006 10:38 AM

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...


All times are GMT -5. The time now is 06:15 AM.