# Copy Dos Batch File



## dcouture (Jan 20, 2007)

Hi, I need help to make a script to copy all my canon .cr2 file (from DCMI\000CANON, 001CAnon, XXXCANON) to another drive and all .cr2 files in the same folder.

Thank you


----------



## JohnWill (Oct 19, 2002)

I can't tell what the full directory specification is from that post, but the basic form of the copy command is.

COPY <destination>

For example:

COPY "d:\Source Folder Name\Sub Folder Name\*.cr2" "d:\Dest Folder Name\Sub Folder Name\"

Note the quotes surrounding the names, these are mandatory for long file names or names with spaces.


----------



## Frank4d (Sep 10, 2006)

I found a batch file here: http://www.lensamalaysia.com/forum/archive/index.php/t-1702.html that (modified as shown below) will copy all of your canon *.cr2 files from all subfolders in your \DCMI folder into one folder.

Make a batch file named COPYCR2.BAT containing these lines:

@echo off
if "%1" == "" goto err1
if "%2" == "" goto err2
for /R %1 %%f in (*.cr2) do copy "%%f" "%2"
goto ending
:err1
echo Please enter the source directory
goto ending
:err2
echo Please enter the destination directory
:ending

Put the batch file in C:\Windows\system32. To copy all of your *.cr2 files into a new folder named allcr2s, type this at a command prompt:

copycr2 c:\DCMI c:\allcr2s

Edit: You do need to create the destination folder first!


----------



## JohnWill (Oct 19, 2002)

Just toss in a MD <destination folder> in the front of the batch.


----------



## dcouture (Jan 20, 2007)

Thank you it work


----------



## gurutech (Apr 23, 2004)

XCOPY is easier, and comes with Windows.


----------

