Re: rename one file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<rant mode="light" type="informative">

Please do not hijack threads. You're probably not aware of what you've done so I'll explain: when you composed your email you found another mail on this list, hit reply, and changed the subject line. *This does not start a new thread*. Most email clients (including yours!) add information to specify exactly which email the reply was to, and email clients can use this information to display emails in nice threads. I find this display essential on high traffic lists such as this, and useful in almost all other situations anyway.

This thread is now actually part of another one - and I nearly didn't read your message because of that.

What you should do is compose a completely new email to the list address (fedora-list@xxxxxxxxxx). If you don't have an addressbook or an alias configured, then many email clients allow you to select an email address (eg: from the one you replied to) and "compose new email to...".

</rant>

Trevor Smith wrote:
The other day I wanted to rename one file from a console window like
this:

filename.extension

to

filename.EXTENSION

A very useful application to do exactly this kind of task in general is "rename".
$ rpm -qf `which rename`
util-linux-2.11y-29
You almost certainly already have this installed. See `man rename` for usage.


I couldn't find any way to do it while leaving the file in the same
directory. I could succeed using KDE/mouse renaming, but mv and cp
refused or failed to rename the file while leaving it in the same
directory.

As others have already noted, the problem is likely that you are not in the same directory as the file(s) you are trying to rename, and are not specifying the directory on the target name. In this case the target directory will be assumed to be the working directory. With `mv` you should either use absolute paths, or `cd` into the directory containing the file first.


However, if you are using `rename` then you do not need to do this.

    $ ls tmp/test.*
    ls: tmp/test.*: No such file or directory
    $ touch tmp/test.EXT
    $ rename EXT ext tmp/test.EXT
    $ ls tmp/test.*
    tmp/test.ext

HTH

--
Stuart




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux