how can i copy all .jpg files in a directory but not the subfolders?

timer Asked: Jul 16th, 2013
account_balance_wallet $5

Question Description

how can i copy all .jpg files in a directory but not the subfolders? Like even i the .jpg files are in the subfolders put all .jpg files in one folder

Tutor Answer

School: UIUC

This should work:

for /r C:\ %f in (*.jpg) do @copy "%f" D:\pictures\


The command copy "%f" D:\pictures copies the file %f to the location D:\pictures, which is the file pictures in the directory D:\.

Adding a trailing \ to make sure copy treats pictures as a directory.

If you copy multiple files to a single location (e. g., copy *.* D:\backup), copy automatically treats backup as a directory. But this is not the case when you copy a single file.

flag Report DMCA

Top quality work from this guy! I'll be back!

Similar Questions
Hot Questions
Related Tags
Study Guides

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors