The directory structure is:
Images
-Folder1
-image1.jpg
-image2.jpg
-Folder2
-image3.jpg
-image4.png
-Folder3
-image6.png
-image7.jpg
-Folder4
I want to copy all images(i.e *.jpg, *.png) files only (not the folders) into the parent directory("Images").
I have tried using "robocopy" as follows:
robocopy /np ..\..\Exam\Images ..\..\Exam\Images *.jpg *.png /S
Here all files as well as folders are copied :(. But I need only files to be copied. How to do this?
Many many thanks in advance!
Robocopy only has the /XD switch to exclude directories but it excludes the whole directory. I'd use a batch file to do it instead.
Try this:
I think COPY or XCOPY is best used for files while I prefer Robocopy when dealing with folders.
Using the posted example try: (adjust paths to suit your needs.
there is an easy to use program called Drop-It if this is a repetitive task then you can use this to sort|move|copy the files to a single directory. hope this helps
an easier way of doing this might be
for /r %%p in (*.png, *.jpg) do copy %%p destinationFolder.
Try this on the command line:
For a bach script the
%
must be doubled%%
.