I have got the directory /home/user/oldname and I want to rename it to /home/user/newname. How can I do this in a terminal?
|
|
||||
|
|||||||||||||||||||||
|
|
To just rename a file or directory type this in Terminal:
with space between the old and new names. To move a file or directory type this in Terminal.
it will move the file to the desktop. If is a directory you should add
|
|||||||||||||
|
That will rename the directory if the destination doesn't exist or if it exists but it's empty. Otherwise it will give you an error. If you do this instead:
One of two things will happen:
Source: How to decide that mv moves into a directory rather than replacing directory? |
||||
|
|
|
This
|
|||
|
|
|
If you want to rename a directory at your level in the file system (e.g., you are at your home directory and want to rename a directory that is also in your home directory):
|
|||
|
|
|
gvfs-rename will rename directories as well. It will give an error if a directory with the new name already exists. The only limitation is that you can't use a path with the folder name. So
will not work, but
will work. Not as useful as mv -T but I read in the man that it was meant for network operations. |
|||
|
|
protected by heemayl Sep 19 '15 at 18:34
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
mvorrename. – John Strood Jul 1 '16 at 20:11