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 /?