Re: copy but not over-write
- From: "Jack B" <jslimp01nospam@xxxxxxxxxxxxx>
- Date: Sun, 13 Dec 2009 17:46:55 -0500
Okay, I finally got it, but not before discovering a snafu of eye-mind
coordination -- the sub directory under Test is 1, not Test 1 -- ha -- I was
going to send you a couple of screen shots when I saw the mistake!
Thanks.
Jack
-----------------------------------
"Pegasus [MVP]" <news@xxxxxxxxxxxxx> wrote in message
news:uYU1r$DfKHA.5292@xxxxxxxxxxxxxxxxxxxxxxx
Sorry, I made a mistake in a last-minute correction. Here it is again.
[1] @echo off
[2] set Source=c:\datamore\test
[3] set Targ=c:\datamore\test\test1
[4] for %%a in ("%Source%\*.*") do (
[5] if not exist "%Targ%\%%~na%%~xa" copy "%%a" "%Targ%"
[6] )
"Jack B" <jslimp01nospam@xxxxxxxxxxxxx> screv in
news:#keTm4DfKHA.2188@xxxxxxxxxxxxxxxxxxxxxxx
I keep getting "the syntax of the command is incorrect"
Jack
----------------------------------
"Pegasus [MVP]" <news@xxxxxxxxxxxxx> wrote in message
news:%23eybuvDfKHA.5020@xxxxxxxxxxxxxxxxxxxxxxx
The batch file works perfectly well, provided that you undo any line wrap
that your newsreader might have created. Here it is again, this time with
line numbers so that you can see exactly where each line starts. Note that
Line 5 is a long line. Remove the numbers before running the file.
[1] @echo off
[2] set Source=c:\datamore\test
[3] set Targ=c:\datamore\test\test1
[4] for %%a in ("%Source%\*.*") do
[5] (if not exist "%Targ%\%%~na%%~xa" copy "%%a" "%Targ%"
[6] )
"Jack B" <jslimp01nospam@xxxxxxxxxxxxx> screv in
news:OviTAmDfKHA.3928@xxxxxxxxxxxxxxxxxxxxxxx
Of course -- here is the file which I named CopyNotSame.bat:
@echo off
set Source=c:\datamore\test
set Targ=c:\datamore\test\test1
for %%a in ("%Source%\*.*") do (if not exist "%Targ%\%%~na%%~xa" copy
"%%a"
"%Targ%")
Jack
-----------------------------------------------
"Pegasus [MVP]" <news@xxxxxxxxxxxxx> wrote in message
news:OECRAaDfKHA.5228@xxxxxxxxxxxxxxxxxxxxxxx
Sorry, can't comment unless I see the code you actually ran.
"Jack B" <jslimp01nospam@xxxxxxxxxxxxx> screv in
news:u1DzCSDfKHA.1648@xxxxxxxxxxxxxxxxxxxxxxx
This looked the easiest, but I couldn't get it to work. It copied
Folder2
into Folder1 as one large bit file with no extension.
Jack
----------------------------------------
"Pegasus [MVP]" <news@xxxxxxxxxxxxx> wrote in message
news:On4Y2U8eKHA.2188@xxxxxxxxxxxxxxxxxxxxxxx
"Jack B" <jslimp01nospam@xxxxxxxxxxxxx> screv in
news:uI4Ssh7eKHA.5792@xxxxxxxxxxxxxxxxxxxxxxx
I have two folders with over 1000 photo files, and most of the files
are
the
same, except in folder A, the files have the EXIF data, but not in
folder
B.
Folder B has slightly more files. How do I copy from B to A
1) without over-writing any files
AND
2) without getting the pop-up that says "Do you want to over-write the
file"
for every single file?
In other words, I would like to copy from B just the files that A does
not
have.
Jack
This little batch file will do it:
@echo off
set Source=c:\Documents and Settings\Jack\My Pics\Folder1
set Targ=c:\Documents and Settings\Jack\My Pics\Folder2
for %%a in ("%Source%\*.*") do (
if not exist "%Targ%\%%~na%%~xa" echo copy "%%a" "%Targ%"
)
Note this:
- Do not retype the code - use copy and paste instead.
- Replace my folder names with actual names.
- Test the code, then remove the word "echo" in the last
line to activate it.
.
- Follow-Ups:
- Re: copy but not over-write
- From: Pegasus [MVP]
- Re: copy but not over-write
- References:
- copy but not over-write
- From: Jack B
- Re: copy but not over-write
- From: Pegasus [MVP]
- Re: copy but not over-write
- From: Jack B
- Re: copy but not over-write
- From: Pegasus [MVP]
- Re: copy but not over-write
- From: Jack B
- Re: copy but not over-write
- From: Pegasus [MVP]
- Re: copy but not over-write
- From: Jack B
- Re: copy but not over-write
- From: Pegasus [MVP]
- copy but not over-write
- Prev by Date: Re: Nearly 100% CPU Usage
- Next by Date: Re: Nearly 100% CPU Usage
- Previous by thread: Re: copy but not over-write
- Next by thread: Re: copy but not over-write
- Index(es):
Relevant Pages
|