The MV Mobile directory is divided into 2 scenarios:
The first type: The target directory is empty, the MV command can be used to move directly, use absolute path to execute or add parameter-F does not prompt whether to move.
[[email protected] ~]# mkdir 1[[email protected] ~]# mkdir/tmp/1[[email protected] ~]# MV 1//tmp/mv:overwrite '/TMP/1 '? N[[email protected]#/BIN/MV 1//tmp/
The second type: The target directory is non-empty, using absolute path execution will also prompt the directory non-empty can not move, need to add a parameter - b plus parameters can be moved, but also back up the target directory one copy. Back up Directory ~Express;
[[email protected] ~]# mkdir 2[[email protected ] ~]# mkdir /tmp/2[[email protected] ~]# touch /tmp/2/2.txt[[email protected] ~]# /bin/mv 2/ /tmp//bin/mv: cannot move ' 2/' to '/tmp /2 ': directory not empty[[email protected] ~]# ls /tmp/1 2 yum.log[[email protected]# /bin/mv -b 2/ /tmp/[[email protected] ~]# ls /tmp/1 2 2~ yum.log
2~ This directory to move the previous/tmp/directory, after the move added ~ to indicate a backup.
This article is from the "Model Student's Learning blog" blog, please be sure to keep this source http://8802265.blog.51cto.com/8792265/1626422
Two scenarios for moving a directory under the Linux MV command