![]() ![]() To move multiple files and directories, specify the files you want to move as the source. If dir2 doesn’t exist, dir1 will be renamed to dir2: mv dir1 dir2 Moving Multiple Files and Directories # ![]() In the following example, if the dir2 directory exists, the command will move dir1 inside dir2. The syntax for moving directories is the same as when moving files. To rename a file you need to specify the destination file name: mv file1 file2 To the /tmp directory you would run: mv file1 /tmp Otherwise, you will receive a permission denied error.įor example, to move the file file1 from the current working directory To move a file or directory, you need to have write permissions on both SOURCE and DESTINATION. Otherwise if DESTINATION exist, it be moved inside the DESTINATION directory. When the SOURCE is a directory and DESTINATION doesn’t exist, SOURCE will be renamed to DESTINATION.If you specify a single file as SOURCE, and a single file as DESTINATION target then you’re renaming the file.If you specify a single file as SOURCE, and the DESTINATION target is an existing directory, then the file is moved to the specified directory.In this case, the SOURCE files are moved to the target directory. When multiple files or directories are given as a SOURCE, the DESTINATION must be a directory.The SOURCE can be one, or more files or directories, and DESTINATION can be a single file or directory.
0 Comments
Leave a Reply. |