DOS Tree Command + batch processing for batch copying of specified files!

Source: Internet
Author: User

Today, a friend asked me to help solve the problem of batch copy of specified files. So I found a lot of batch processing commands and finally solved the problem. Principle: Integration Tree The file generated by the command, and then analyzes the file names in the generated file through the batch processing command, and then copies them to the specified directory in batches. Below are the steps:
First   Open command line   ( Win + R Open the run dialog box and enter CMD Open)   Assume that E: \ txt Files in this folder  

  In DoS Command Line   Input   :

A file named File File  
Open with notepad  

We can see that Txt Folder   All file names.
Now let's write the batch processing command:
 
Echo Make sure that the "file for saving the file name" File This program is in the same directory
Set/P lj = Enter the path to be copied:
For/F "tokens = *" % A in (File) Do (
For/F "tokens = *" % I in ('dir/S/B/a-d % A') Do (
Copy "% ~ Dpnxi "" % LJ %"
)
)
 
Save the preceding command . Bat File

The File File And Copyfile. bat Copy files together Txt Directory

Double-click Bat File Execute the batch processing program

Press ENTER The command flashed through : Finally, we ABC Folder found Txt Files copied in the folder

 
To better understand the execution process We can DoS Command Run . Bat File

Because File File contains such fields :

Therefore Batch query Name of the three rows If not Enter the next line The processing method is top-down. One row reads the file name
 
Okay, here. The entire process has been completed! Leave a message if you are not clear! Or mail to tienfook # gmail.com (# Change @)



@)

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.