COPY /W does not delete files in the target

Aug 28, 2008
124
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.
 
May 20, 2008
11,534
103
Syracuse, NY, USA
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
124
4
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
12,404
152
> ---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
124
4
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
Thread starter Title Forum Replies Date
R WAD Copy /w does not use recycle bin Support 7
N TCC v12.10 COPY /F does not work Support 10
noahcoad copy /w to FTP does not set time stamp Support 1
C blank line in copy ... results Support 9
C Copy (sys) error Support 3
Alpengreis Fixed Crash after copy dialog with big TCC.exception.log Support 5
vefatica Copy/Paste anomaly Support 4
D Documentation Typo in COPY help Support 0
samintz COPY fails to copy from \\wsl$ Support 20
D Differences between TCC and CMD with COPY /b Support 4
fpefpe copy /u and timestamps Support 4
M Strange error messages from TCC in FTP copy Support 7
G TCMD crash when copy Support 3
Alpengreis How to? Copy DIRs with attributes ... Support 4
E Text copy bug Support 1
Alpengreis [TCMD v25.00.24] Problem with copy and paste and the # char via mouse in TCC Support 6
fpefpe copy/cat Support 7
K copy /w slow relative to robocopy /mir Support 0
Jay Sage Problem with Context Menu Copy+Paste+Run Key Assignment Support 7
K "copy /z /w" command not deleting read-only files in destination Support 10
K copy changing destination current directory Support 1
D Keystroke to copy previous argument Support 3
A How to? Copy+Paste in TCMD tabs with Ctrl-Shift-Ins? Support 5
RChrismon How to? Copy TCMD.INI to New Version Support 7
R How to? Append files in multiple subfolders using copy? Support 8
Dick Johnson COPY /u (?) Support 9
fpefpe Documentation copy /u Support 7
R How to? copy /q ABC.txt + DEF.txt is appending hex 1A Support 8
D copy /g only shows transfer rate Support 1
J Error "Contents lost before copy" Support 3
B Can copy command concatenate multiple mp3 files Support 2
rps Documentation "Copy+Paste+run" question Support 2
kb6ojs Make /G parameter persistent in COPY/MOVE command? Support 4
fpefpe How to? copy / exclude Support 2
fpefpe robocopy -- copy /w Support 8
C copy /w /p prompts for deletion, but ... Support 3
D Fixed Copy Support 1
fpefpe Documentation copy/move using /c or /u Support 2
samintz WAD Copy/append adds a character Support 3
P Simple RegEx copy Support 9
fromano Fixed COPY ... TO ... crashing Support 3
Alpengreis How to? Copy & Paste without linebreak within TCMD Support 13
D COPY returns ERRORLEVEL 2 Support 5
mdwyer TCC 13 COPY: specified network name is no longer available. Support 5
CWBillow Copy a tree Support 17
J junction copy/move handling Support 6
vefatica Fixed COPY /S ftp://... Support 1
C WAD copy /u ftp local with Timeout? Support 5
D How to? Unregister a copy of Take command Support 1
vefatica FTP copy interrupted Support 2

Similar threads