Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

COPY /W does not delete files in the target

Aug
132
4
I can't get the new /W switch for the COPY command to work as described with the latest update ("VER /R" reports TCC 11.00.38 x64 Windows Vista [Version 6.0.6002]). Here are the steps I'm taking:

  1. I create two testing folders C:\A and C:\B.
  2. I copy some documents into A.
  3. I copy all the documents from A to B.
  4. I add a new document to B that isn't in A.
  5. I execute: COPY /W C:\A\*.* C:\B\*.*
The command does not delete the file I added to B that isn't in A. Can you please advise me as to why this is failing? Thanks.
 
On Sat, 16 Jan 2010 18:07:35 -0500, Phileosophos <> wrote:

|I can't get the new /W switch for the COPY command to work as described with the latest update ("VER /R" reports TCC 11.00.38 x64 Windows Vista [Version 6.0.6002]). Here are the steps I'm taking:
|
|1. I create two testing folders C:\A and C:\B.
|2. I copy some documents into A.
|3. I copy all the documents from A to B.
|4. I add a new document to B that isn't in A.
|5. I execute: COPY /W C:\A\*.* C:\B\*.*
|
|The command does not delete the file I added to B that isn't in A. Can you please advise me as to why this is failing? Thanks.

It works if you do it this way:

v:\> copy /w dira\ dirb\
Deleting V:\dirb\foobar.txt
1 file deleted
V:\dira\foo.txt => V:\dirb\foo.txt
1 file copied
--
- Vince
 
It works if you do it this way:

v:\> copy /w dira\ dirb\
Deleting V:\dirb\foobar.txt
1 file deleted
V:\dira\foo.txt => V:\dirb\foo.txt
1 file copied
--
- Vince

First, thanks for the help, Vince, that does work. Second, is the "/W" switch really supposed to be limited like that, by which I mean you can't limit it to a particular filespec or anything like that? I didn't see anything about that in the documentation.
 
> ---Quote (Originally by vefatica)---
> It works if you do it this way:
>
> v:\> copy /w dira\ dirb\
> Deleting V:\dirb\foobar.txt
> 1 file deleted
> V:\dira\foo.txt => V:\dirb\foo.txt
> 1 file copied
> --
> - Vince
> ---End Quote---
> First, thanks for the help, Vince, that does work. Second, is the "/W"
> switch really supposed to be limited like that, by which I mean you
> can't limit it to a particular filespec or anything like that? I didn't
> see anything about that in the documentation.

/W only works with directory names, not individual filenames.

Rex Conn
JP Software
 
Good to know. And it makes a certain sense. Allow me to quote the documentation:

/W Delete files in the target directory that don't exist in the source directory. (Use this instead of SYNC when you only want to synchronize "one way".)
That really needs to be updated to make clear what you've said. :)
 

Similar threads

Replies
7
Views
2K
Back
Top