The operation of moving a folder under Linux to the next level of the current directory

cp command

Move existing files to the next level directory. You can create a new level directory folder, now move the file to the level directory folder and then cp to the next level directory of the original folder.

Command: cp dir1/a.doc dir2 means to copy the a.doc file under dir1 to the dir2 directory

cp -r dir1 dir2 means to copy dir1 and the files contained in dir1 to dir2

cp -r dir1/. dir2 means to copy the files under dir1 to dir2, excluding the dir1 directory

Description: cp parameter -i: ask, if the target file already exists, it will ask whether to overwrite;

 

 

 

mv command

find /home/dcos/files/20200412/ -name "*.txt" -exec mv {} /home/dcos/text/ \; means to move files ending in txt format in this directory to other directories

Guess you like

Origin blog.csdn.net/qq_37980436/article/details/105089330