Use command line to copy a folder and command line to copy a folder

Source: Internet
Author: User

Use command line to copy a folder and command line to copy a folder

Some tedious work in windows we can use batch processing to simplify our workload.

This requires the use of command lines. For example, a requirement today is to deploy the current development project to another tomcat.

If it is difficult to manually deploy each time, let's hand it over to the system for help. This requires batch processing.

First, we need to copy the project files under webapps in current tomcat to webapps of another tomcat.

The command used here is xcopy, and XCOPY is an extension of COPY. You can COPY the specified directory and the directory structure together, but you cannot COPY the system file;

Basic usage: xcopy source folder target file

In addition, there are a lot of parameters that can be configured. Here we will briefly introduce some of

/E: Copy directories and subdirectories, including empty ones. There is also a directory named/s, which only copies directories and subdirectories that are not empty.

/Y: Do not prompt you to confirm that you want to overwrite the existing target file.

/D: [: mm-dd-yyyy] Only copies the source files changed after the specified date or date. If the value of mm-dd-yyyy is not included, xcopy copies all the new Source files than the existing Destination files. This command line option allows you to update changed files.

The/d option is equivalent to incremental replication, which is very efficient. Therefore, we use this command to copy the project to another tomcat.


How Can I copy folders to other places using command lines?

Copy a.exe d :\
This is a copy file

Copy c: \ dd d: \ or xcopy c: \ dd d :\
This is to copy all the files under the file dd to d: \, but do not copy subfolders

If you copy a folder, DOS does not seem to have such a command.
Delete a folder.

How to Use cmd to copy files or folders and describe the specific process

File copy. The basic usage is as follows:
Copy c: \ 123 d: \ 123 // copy the 123 file under drive c to drive d
Copy/y c: \ 123 d: \ 123 // you do not need to confirm the copy, directly Overwrite
Xcopy for folders
Xcopy c: \ 123 \ d: \ 123 \ // copy the files not including folders in the 123 directory of drive c to d: \ 123
Xcopy/e c: \ 123 \ d: \ 123 \ // copy sub-directories simultaneously
For more information, see:
Copy /?
Xcopy /?

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.