Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want my files to be copied in one folder, the files came from different folder but in the same location.

I run this code in CMD but it copies the folder into new directory.

xcopy "D:\NBS Contents\Latest Images\*.jpg" "D:\output" /s

The latest images folder has many folders containing images files. I want to combine them into one folder.

share|improve this question
    
Do you really mean DOS or do you mean CMD? –  Bobby Sep 24 '10 at 8:11
    
CMD rather sorry. –  text Sep 24 '10 at 8:14
    
You may want to check my answer to the other question. I've made an application that does this, and it handles unexpected situations too, plus shows stats, and has some command-line niceties. –  Camilo Martin Dec 27 '10 at 21:58

1 Answer 1

So in cmd you'll to have to do the below steps

D:
mkdir output
cd "D:\NBS Contents\Latest Images\"
for /r %f in ( "*.jpg" ) do copy /y "%f" "D:\output"

Step by step explaination:

  • D: - switches to D: drive
  • mkdir output - Creates output directory
  • cd "D:\NBS Contents\Latest Images\" - Changes current directory to the one in quotes

  • for /r %f in ( "*.jpg" ) do copy /y "%f" "D:\output" - Recursively, for every jpg file, copy the source file to d:\output. The /y switch suppresses Are you sure you want to overwrite prompt, you can remove the switch if you want the prompt.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.