Copy Dos Batch File

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

dcouture

Thread Starter
Joined
Jan 20, 2007
Messages
2
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

Retired Moderator
Joined
Oct 19, 2002
Messages
106,429
I can't tell what the full directory specification is from that post, but the basic form of the copy command is.

COPY <source> <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

Retired Trusted Advisor
Joined
Sep 10, 2006
Messages
9,126
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

Retired Moderator
Joined
Oct 19, 2002
Messages
106,429
Just toss in a MD <destination folder> in the front of the batch. ;)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top