If you are using Ubuntu inside Windows using WSL, you will have the SysV instead…
How to use mv command exclude directory
The mv (short from move) is a Unix command that use to rename and move files and directories from one place to another. The syntax of the mv command is as follow :
mv [OPTIONS] SOURCE DESTINATION
Let’s assume we have the directory structure like below:
|parent
|--dir1
|--dir2
|--dir3
|--file1
|--fiel2
|--file3
|--file4
|--file5
And we want to move all files and directories to directory dir1, so that it would appear like,
|parent
|--dir1
| |--dir3
| |--file1
| |--file2
| |--file3
| |--file4
| |--file5
|--dir2
In this case, you need to exclude two directories dir1 and dir2
, and move rest of the files and directories into dir1 directory. So we need to use command like below :
mv *[^dir1dir2]* dir1
This will move all of rest of the directories into dir1
directory.
This Post Has 0 Comments