COPY /W does not delete files in the target

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Aug 28, 2008
86
2
#1
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.
 
#2
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
 
Aug 28, 2008
86
2
#3
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.
 

rconn

Administrator
Staff member
May 14, 2008
10,101
85
#4
> ---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
 
Aug 28, 2008
86
2
#5
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. :)