Discrepancy in handling of "can't copy or move file to itself"

Feb 23, 2012
240
3
When trying to copy or move a file to itself (e.g. "copy *.* ." or "move *.* ."), the error reported is: "Can't COPY or MOVE file to itself".
However, what happens next is not always the same. If the operation is a "copy" operation, then TCC continues processing with the next file. However, if the operation is a "move" operation, TCC aborts the operation.
This means, for instance, that a command like "copy *.* . /sx" will succeed in copying all of the files from the subdirectories, while "move *.* . /sx" will not.
Is this discrepancy deliberate? (Personally, I'd prefer that TCC continue [rather than aborting] in both cases, skipping the problematic files, and continuing with the rest).
 
May 24, 2010
855
0
Northlake, Il
Avi, I think the "/O" parameter is what you want on the "Copy" and "Move" commands unless you want to copy files that have the same name from another source over the existing files in the destination directory (could be, I suppose, but I tend to doubt it...)
 
Feb 23, 2012
240
3
Yes, that did the trick! Thanks so much, Dan!

In any case, though, the discrepancy in the handling of the "cannot copy or move file to itself" error still seems anomalous - why should it be a critical error in "move" but a non-critical error in "copy"?

Avi, I think the "/O" parameter is what you want on the "Copy" and "Move" commands unless you want to copy files that have the same name from another source over the existing files in the destination directory (could be, I suppose, but I tend to doubt it...)
 

rconn

Administrator
Staff member
May 14, 2008
12,340
149
n any case, though, the discrepancy in the handling of the "cannot copy or move file to itself" error still seems anomalous - why should it be a critical error in "move" but a non-critical error in "copy"?

WAD (and what users had requested years ago). In the case of MOVE, the user expects the original file to be gone (and the directory removed). In the case of COPY, in the worst case the source and the target will both still be there.
 
Similar threads
Thread starter Title Forum Replies Date
nickles WAD [Discrepancy] Have rmdir work like described in the docs Support 7
David McClelland MKLINK /x discrepancy Support 0
vefatica Onig discrepancy solved? Support 0
vefatica Onig discrepancy Support 19
vefatica WAD TCC: inconsistent character handling Support 11
M Handling of %~I problem Support 4
J File explorer handling from command line? Support 2
forbin Strange handling of [nonbright] magenta background (v22) Support 2
T WAD Difference between TCC and CMD in handling multi-command lines Support 6
thorntonpg Handling files with embedded spaces Support 1
J junction copy/move handling Support 6
C How to? MOVE and handling out of space Support 2
The Wizard WAD Possible Incorrect COMSPEC handling Support 2
BobK How to? Handling filenames with blanks at command line Support 3
Frank WAD handling variables with $-prefix Support 14
M How to? A question about error-handling... Support 25
S Description handling Support 3
B Strange handling of a .BAT file Support 5
C handling percent signs in filenames Support 2
C handling percent signs in filenames Support 1
S Ctrl-C handling while piping Support 0
vefatica Icon handling in b153 Support 7
U An annoying bug with TCC's icon handling in the taskbar Support 25
p.f.moore Bug in plugin break handling? Support 0
p.f.moore Error handling in plugins Support 2
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

Similar threads