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

Feb 23, 2012
238
3
#1
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).
 
#2
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
238
3
#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
10,551
97
#4
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.