The goal is to update all files and add an extension as suffix. In this example there are many files in a folder which doesn't have any extension. All examples assume that terminal is opened with the directory where the files are stored! If not you can do it by: cd /home/user or you can check the working folder by: pwd Add suffix or prefix to all files in folder
How to use find to rename directory Linux? So there will not be any data loss while renaming your directories on Linux. $ mv /home/nayan/devicemaze/dir1 /home/nayan/devicemaze/dir4Īlso, you should know that the “mv” command will not delete any content stored in that specific directory. Then you have to enter the location of the directory again and add the new directory name.
Over here, the source_directory and target_directory both refer to the location where the directory to be renamed is located.Īfter adding “mv” in the Linux terminal, you have to specify the source directory location+ of the old directory name. To rename a directory on Ubunutu, you have to use the “mv” command and then specify the directory to be renamed along with the destination of that directory only.įor this, use the following command: $ mv With the help of “mv” command, you can move files from one place to another as well as rename the directory on Linux.Īnyway, to get started with the command, here are the steps that you have to follow: Also, this command serves multiple purposes. But it uses a specific command called “ mv”. Now my goal is to rename the dir1 directory to dir4.Īlso, you should know that renaming directories on Linux cannot be done with a dedicated renaming command. For this tutorial, I have created a folder named DeviceMaze, and under it, I have three directories, which are the dir1, dir2, and dir3.