How can I copy files from multiple folders using the Windows command line?

12,371

you can try it using a batch file
place all the copy commands that you need into the batch file, for example

copy <path1>\file*.txt <destination> 
copy <path2>\file*.txt <destination>

and so on as many times as you need. Then run the batch file
Create the batch file in notepad and save with the .bat extension

Share:
12,371

Related videos on Youtube

victor
Author by

victor

Updated on September 18, 2022

Comments

  • victor
    victor over 1 year

    I have txt files in multiple folders: (folder_1, folder_2 . . . folder_n).

    I would like to copy all these files into another directory using the Windows command line.

    How can I accomplish this?

    • tvdo
      tvdo almost 12 years
      How would you like conflicting filenames to be handled? Ignored (skipped)? Overwritten? Abort the copy operation? Could you provide an example (list some sample source file paths and same destination file paths)?
    • tvdo
      tvdo almost 12 years
      Would the answers to this question help? They handle conflicting filenames.
  • tvdo
    tvdo almost 12 years
    The question is asking about copying files from multiple folders. Unless you are recommending manually changing to each directory before copying, this does not answer the question. And the question implies a large number of directories where manual switching is far from optional.
  • Chuzein Part II
    Chuzein Part II almost 12 years
    I apologize if I am wrong answer just to answer what I understand