Copy directory and delete under Linux

Source: Internet
Author: User

The CP command is used to copy files or directories, and if a colleague specifies more than two files or directories, and the last destination is an existing directory, it copies all of the previously specified files or directories to this directory. If you specify multiple files or directories at the same time, and the final destination is not an existing directory, an error message appears.

CP [parameter] source file or directory destination file or directory

CP Parameters:

-a--archive the number of links, file attributes, and recursion to the copy directory, function equals the combination of the DPR option

-B--backup Delete overwrite destination file backup first, backup file or directory is also established as symbolic link, and point to source file or directory link source file or directory. If this parameter is not added, the source file or directory will be copied directly if a symbolic link is encountered during the copy process.

-F--force forcibly copy files or directories, regardless of whether the destination file or directory is an inch.

-I--interactive ask the customer before overwriting the file

-L--link to create a hard link to the source file instead of copying the file

-P--preserve preserves the properties of the source file or directory, including owner, all groups, permissions and time

-P--parents retains the path to the source file or directory, which can be an absolute or relative path, and the destination directory must already exist

-R recursive processing, the files and subdirectories under the specified directory are processed together

-R--recursive Creating symbolic links to source files instead of copying files

-S--symbolic-link link to the source file CV symbol instead of copying the file

-s< Backup Tail string >--suffix< backup string > After backing up the destination file with the-b parameter, a backup string is added to the end of the backup file. The default backup Word tail string is ~

-U--update copies files when the source file is modified more than the destination file, or if the destination file for which the name corresponds does not exist

-V--verose shows the execution process

-v< Backup Mode >--version-control< Backup method > Specifies that when backing up files, the backup file name is named in the following 3 ways:

1.numbered or T will use the backup number, will be added to the Crape Myrtle String 1, the number is incremented sequentially

2.simple or never will use a simple backup, the default backup word tail string is ~, can be specified by-s

3.exisitng or nil will use the current mode, the program will first check if there is a backup number, if there is a backup number, if not, use a simple backup

-X--one-file-system the file or directory in which the file system is stored must be the same as the file system where the CP instruction is executed, otherwise it will not be copied or processed in other partitions

--help Show online Help

--sparse< Use time > Set the time to save sparse files

--version Realistic Version

Cp-u-V file1 file #自由源文件较目的文件的修改时间新时才复制

Delete Directory

RM Common Parameters

-R down recursion. No matter how many directories you have, delete

-F directly forcibly deleted without any hint

  

Copy directory and delete under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.