linux copy all files except a certain folder

For example, there are data, train.py, inference.py, utils and other files or folders in the root/file/ directory, and all files except the data folder should be copied to the copy_file directory

First enter the root/file/ directory to be copied, and execute the following command: 

cp -r `ls |grep -v data|xargs` ../copy_file/

 

Guess you like

Origin blog.csdn.net/qq_36076233/article/details/114873123