首页 > 代码库 > linux command cp.

linux command cp.

Examples

cp file1.txt newdir

Copies the file1.txt in the current directory to the newdir subdirectory.

cp /home/public_html/mylog.txt /home/public_html/backup/mylog.bak

Copies the file mylog.txt in the public_html directory into the public_html/backupdirectory as mylog.bak.

cp -u *.txt newdir

Copy all files ending in .txt into the newdir directory, but only if the files do not already exist in the new directory, or if the files being copied are newer.

cp -r /home/hope/files/* /home/hope/backup

Recursively copies all the files, directories, and subdirectories in the/home/hope/files directory into the /home/hope/backup directory.