To rename a folder in Unix, you can use the mv
command in the same way that you would use it to rename a file.
For example, to rename the folder oldname
to newname
, you can use the following command:
mv oldname newname
This will rename the folder oldname
to newname
in the current directory.
You can also use the mv
command to move a folder to a different directory at the same time as renaming it. For example, to rename the folder oldname
to newname
and move it to the /tmp
directory, you can use the following command:
mv oldname /tmp/newname
This will move the folder oldname
to the /tmp
directory and rename it to newname
.
Note that the mv
command will only rename the folder itself, not the files and subfolders inside it. If you want to rename the contents of the folder as well, you will need to use a separate command or a script to do so.
Overall, the mv
command is a simple and powerful tool for renaming and moving folders in Unix.