OKay then can yoiu help me with a single drive. Lets take with D Drive, there are few pictures that I need to get copied, will you help me with this please.
I am glad you asked. The others are helping you with the problems involved in using a for loop. As you can see, they have mentioned some of the problems you're going to come into.
Here is a very simplified answer that follows. But first, I want to make sure that you do not intend just the simple command that works quite well from DOS.
XCOPY D: E: /S
In this very simple command, which you should already know the entire contents of drive D: we'll be copied to drive E.: with all of its subdirectories.
And the variations of that could select just all the files of a certain type in all the entries on the drive.
But, since you already knew that, we will assume that is not what you meant. That command to locate all the files of one type on a drive is as follows:
DIR D:*.jpg /s
That command will show you all the files of that type in all the directories on that drive. Using this command before you do anything else will help you understand if you have too many files to deal with. We hope we don't get any more than maybe 200 or so files. Going beyond about 200 is so files may present a problem in Windows XP. Also, this command gives you some idea of the size. The command should give you a summary at the end of what the total size is for all the files of that type found on that drive. If we get a number that's up in the gigabyte range we had better be careful about trying to copy this to another directory or another drive, unless we know we have that much space available.
So my point is, we want to have some restraint and some discipline in what we are doing before we start writing some code. Now let's do something else:
DIR *. jpg /s /b >newjob.bat
Here we get a brief directory listing that is sent to a file that we have decided to call "newjob.bat" and part of the contents look like this:
D:\BaaBaa\BIGJOB.jpg
D:\BaaBaa\DIRT.jpgexit
D:\BaaBaa\EbayJob.jpg
D:\Baby\New\Bras.jpg
D:\Baby\New\Jho.jpg
D:\Bart\New\Jho.jpg
D:\CarAndDog\New\Demo1.jpg
D:\CarAndDog\New\Demo3.jpg
D:\Baby\New\Nice.jpg
D:\Baby\School\Demo1.jpg
D:\Baby\School\Demo2.jpg
At this point I will use Notepad to open this file and take a look at it. I am going to replace every instance of "D:" with the replacement "Copy D:" and after that I will replace every occurrence of ".jpg" width ".jpg \alljpg", but before I save the file I need to make some changes. Can you see where I am going to have some duplicate filenames and I need to change these to avoid the conflict.?
(And besides that, don't forget to make a directory called " \alljpg" at the root.)
Do you understand what I am doing? Is this computer programming? Yes, it is I'm using the computer to write a program using an editor and my final result will be a batch file that I'm very confident will work right first time. I like it when things were right the first time. This is a case where use this apply the power of the human operator to quickly provide a solution that will avoid a problem that could cause much difficulty later on. Namely, the loss of files or the creation of directories that do not have all the files you want and you don't know which ones are missing.
This post was done almost entirely with my voice recognition software.