0

I want to copy all the files from different folders to same location.

Like :

Folder ABC
  1. File1.pdf
  2. File 2.pdf
  3. File 3.pdf
  4. File 4.pdf

Folder PQR
  1. File5.pdf
  2. File 6.pdf
  3. File 7.pdf
  4. File 8.pdf

Folder XYZ
  1. File 10.pdf
  2. File 11.pdf
  3. File 12.pdf
  4. File 13.pdf

Final Result Should be :

FolderName - C:/Final/

  File1.pdf,
  File 2.pdf,
  File 3.pdf,
  File 4.pdf,
  File5.pdf,
  File 6.pdf,
  File 7.pdf,
  File 8.pdf,
  File 10.pdf,
  File 11.pdf,
  File 12.pdf,
  File 13.pdf

Please Note: I do not have Linux/Unix box.

I would like to do using Windows commands.

Please help.

2
  • Welcome to SuperUser! Please look at the preview before posting, you'd see that there was something very wrong with your formatting. You can find some formatting tips in Help.
    – gronostaj
    Dec 26, 2013 at 11:05
  • @gronostaj if his formatting is wrong e.g. if he didn't intend to put a space or he omitted a space in his filenames, he should really be able to see that after he posts as well, and could always edit it once seen it. So even without preview he should notice. Often I make a post, I posted it without a preview, then I edit it straight away if I see any issue.
    – barlop
    Dec 26, 2013 at 11:13

3 Answers 3

2

Hope somehing like this is what you are looking for, as far as we don't have a lot of infos about your constraints and your tree structure.

for /r c:\source\ %x in (*.pdf) do copy "%x" "c:\target" /y

Here i am assuming that Folder ABC,Folder PQR (and so on) are all subfolders of something like c:\source\

2
  • Thanks for the command. Am should i use it in Batch file? or I should execute it directly in command prompt ?? Am sorry this is the first time am working on these commands( as one of my project needs these approach) and and I am not sure how should i do. Can you please explain in detail. thanks! Dec 28, 2013 at 22:01
  • This command can be run in a batch file or directly in command prompt, it's up to you. If you intend to use this command many times it is better to put it in a batch file, so that a simple double-click on the .bat file will run the command Dec 28, 2013 at 22:18
2

You don't have to use command line. Let's say your files are:

C:\Blah\Parent\Folder1\File1.pdf
C:\Blah\Parent\Folder1\File2.pdf
C:\Blah\Parent\Folder2\File3.pdf
C:\Blah\Parent\Folder2\File4.pdf

Just open C:\Parent in Windows explorer (Parent is the deepest parent folder to contain all PDFs) and type *.pdf in the search box. Wait until all files show up, then press Ctrl+A to select them all and just copy them to the target directory. Standard dialogs will pop up in case of any conflicts.

4
  • Best approach to do this!
    – Hunter
    Dec 26, 2013 at 15:49
  • @Hunter upvoting will make this answer more visible :)
    – gronostaj
    Dec 26, 2013 at 16:21
  • @Hunter This Approach seems easy for me. But As this is for my official purpose am not sure if i can do so in my client shared drive. I will check. Dec 28, 2013 at 21:58
  • @shobhakashyap you can try my method as Teracopy is a software and can be used on client shared drive.
    – Hunter
    Dec 29, 2013 at 4:23
0

You should download some type of drop-box that lets you drop files from different location and lets you to copy them somewhere. Teracopy should do the trick so why do you need to use only CMD when you can use it.

1
  • Sounds like an overkill to me.
    – gronostaj
    Dec 26, 2013 at 11:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .