Copy files NOT folders from CD

I have 5 CD#s with perhaps 100 folders each containing thousands of  images and need to copy the images only to a folder on my C: drive called 'images' where they will be worked on.

At the moment I am using a command prompt to open each folder and then using Xcopy to copy and verify each file in its destination. The problem is that this is very time consuming as each folder takes about 10 minutes at which point I have to change directory and start the copy again.


What would be much better is a tool that enables copying of all files from the CD without copying the folders.

E.G.

The contents of d:\0b\*.* and d:\0c\*.* (plus the other 100 or so folders)

get copied to c:\images

Does anyone know of any utility (preferably free) that might help
boldnbrash73Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kapesCommented:
tell me ...

U don't want the folder structure to come with file copy... only files should be copied to c:\images..?

If yes and if Images extention are common then

do this...

Assume your cd rom drive letter =   Y
assume your images file extentions is = JPG

run this command

dir /a /s /b Y:\*.jpg > JPGfiles.txt
for /F "Tokens=1*" %%A in (JPGfiles.txt) do copy "%%A"  c:\images /y

It will first create list of all JPG files with full path to each file..
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kapesCommented:
You must put the above two command in a batch file then run

if you want to directly run from command prompt then

do this

dir /a /s /b Y:\*.jpg > JPGfiles.txt
for /F "Tokens=1*" %A in (JPGfiles.txt) do copy "%A" c:\images /y


0
Lee W, MVPTechnology and Business Process AdvisorCommented:
kapes has an excellent solution.  One thing that _I_ would modify:

for /F "Tokens=1*" %A in ('dir /a /s /b Y:\*.jpg') do copy "%A" c:\images /y

No need for the seperate dir line.

Alternatively, run from the CD's root directory:
for /r y:\ %a in (.) do @copy %a\*.* c:\images /y

Note: any time you use for in a batch file, the %a must be %%a - outside of a batch file, it's just %a.  You can reference other system variables normally.
And just to take it a step further, this script should actually prompt you for the other CDs.  Also, my examples use the same assumption kapes' do.

---------------8<-------------------------
@echo off
Set /p rootdircopy=What is the root directory you are copying from?  For example - c:\temp:
set /p targetdir=What is the target directory you are copying to?
set /p cds=How many CDs?
:start
If %counter% gtr %cds% Goto End
for /r %rootdircopy% %%a in (.) do @copy %%a\*.* %targetdir% /y
set /a counter=%counter% + 1
Echo Please insert cd %cds% and
pause
:end
---------------8<-------------------------
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

boldnbrash73Author Commented:
I have had succes with kapes method but none with the script from leew. Although a batch file was my prefered method I can easily make one using the script examples from kapes.

With this in mind  a big thanks to leew but the full points go to kapes for providing an immediate working solution.
 Sorry but i have no time to debug your code with you leew, but here is what i used

@echo off
Set /p rootdircopy=d:\
set /p targetdir=c:\images\
set /p cds=4
:start
If %counter% gtr %cds% Goto End
for /r %rootdircopy% %%a in (.) do @copy %%a\*.* %targetdir% /y
set /a counter=%counter% + 1
Echo Please insert cd %cds% and
pause
:end

0
kapesCommented:
Also... During testing i found that...it won't copy if file path contains the spaces so ...

This is the updated line....(it will take care of spaces in the file path)...

for /f "Tokens=1* Delims=*" %A in ('dir /a /b /s y:\*.jpg') do copy "%A" c:\images /y


0
kapesCommented:
changes to leew's  Script...
He assumes that you want to copy every file available and not only images...

* Counter was not set beforehand (not a major issue but better to do it...)
* he assumes your working directory will be SOURCE DIR and starts from there...
* Not looping back to START

---------------8<-------------------------
@echo off
Set /p rootdircopy=What is the root directory you are copying from?  For example - c:\temp:
set /p targetdir=What is the target directory you are copying to?
set /p cds=How many CDs?
set counter=1
:start
:: Next line will set wroking directory as %rootdircopy%
cd /D %rootdircopy%
If %counter% gtr %cds% Goto End
for /r %rootdircopy% %%a in (.) do @copy %%a\*.* %targetdir% /y
set /a counter=%counter% + 1
Echo Please insert cd %cds%
pause
:: next line will go back to START and run the loop again...
goto start
:end
---------------8<-------------------------


if you  want to copy more than... one extension...
e.g. Say provide a list of extension with semicolon (;) separating each value in a variable
use for loop to separate them and loop the it in the above script..

Try that for a scripting practice..
if u need help.. just buzz me..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows XP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.