Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm wondering if it's possible to copy only images files from a directory. For example, if source directory has:

a.jpg b.gif c.png d.txt

I want to copy only the images using one command, to get this in the destination directory:

a.jpg b.gif c.png

share|improve this question
i retagged "windows" and "cmd" assuming you're using the CMD terminal on Windows NT/2k/XP/Vista/7. if you're actually using DOS (meaning MS-DOS 6.22 or earlier, or FreeDOS or another DOS variant), please retag with "dos". – quack quixote Apr 15 '10 at 12:35
up vote 3 down vote accepted

At command prompt:

FOR %X IN (*.png *.jpg *.gif) DO COPY %X Destination

In a .bat or .cmd script:

FOR %%X IN (*.png *.jpg *.gif) DO COPY %%X Destination
share|improve this answer

Your Answer


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.