Linux Rename Folder Command

www.l‮.iruttua‬com
Linux Rename Folder Command

To rename a folder in Linux, you can use the mv command. This command is used to move files and directories, but it can also be used to rename them by moving them to the same directory with a new name.

For example, to rename a folder named "oldfolder" to "newfolder", you can use the following command:

mv oldfolder newfolder

This will rename the folder "oldfolder" to "newfolder". If a folder named "newfolder" already exists in the same directory, it will be overwritten by the renamed folder.

You can also use the mv command to rename a folder and move it to a different directory at the same time. For example:

mv oldfolder /path/to/new/directory/newfolder

This will move the folder "oldfolder" to the directory "/path/to/new/directory" and rename it to "newfolder".

Keep in mind that the mv command can only be used to rename folders within the same filesystem. If you want to rename a folder on a different filesystem, you will need to copy the folder to the new filesystem and then delete the original folder.

You can use the cp command to copy the folder and the rm command to delete it. For example:

cp -r oldfolder /path/to/new/filesystem/newfolder
rm -r oldfolder

This will copy the folder "oldfolder" to the new filesystem and rename it to "newfolder", and then delete the original folder from the original filesystem.

Note that the -r option is used to copy the folder and all of its contents, including any subdirectories and files.

Created Time:2017-10-30 10:17:37  Author:lautturi