COPY returns ERRORLEVEL 2

Mar 3, 2009
6
0
When copying a directory with only subdirectories, COPY return an ERRORLEVEL 2 as seen in the clip below. When directory "Appendix of SDD" is copied, the error occurs. Is there a way to force the COPY command to return a value of zero? Normally this is not an issue, but when COPY is called from a Python script, the program crashes.

Capture.JPG
 
Jan 12, 2014
426
7
Switzerland, SO
When copying a directory with only subdirectories, COPY return an ERRORLEVEL 2 as seen in the clip below. When directory "Appendix of SDD" is copied, the error occurs. Is there a way to force the COPY command to return a value of zero? Normally this is not an issue, but when COPY is called from a Python script, the program crashes.

View attachment 1008
I would have a workaround only ... you could expanding your command line as follow:

Code:
echo tmp > "o:\Test\test.tmp" & copy /D /F /H /J /K /V /Y /Z /S /MD /UF "o:\Test\" "d:\Projects\Test\" & del "o:\Test\test.tmp" & del "d:\Projects\Test\test.tmp" & echo %_?


Then the errorlevel should be 0 ... as you can see from my test example ...

Code:
[D:\_Temp_]echo tmp > "d:\_Temp_\test\test.tmp" & copy /D /F /H /J /K /V /Y /Z /S /MD /UF "d:\_Temp_\test\" "d:\_Tests_\" & del "d:\_Temp_\test\test.tmp" & del "d:\_Tests_\test.tmp" & ECHO %_?
D:\_Temp_\test\test.tmp => D:\_Tests_\test.tmp
     1 Datei kopiert
Lösche D:\_Temp_\test\test.tmp
     1 Datei gelöscht
Lösche D:\_Tests_\test.tmp
     1 Datei gelöscht
0


BTW: I have corrected the "/F/" param to "/F" because it's a typo?! However: should be not related to the errorlevel ...
 
Last edited:
Mar 3, 2009
6
0
WAD - COPY will return an error if it didn't copy any files. You can work around it by adding the /U option (or /C, depending on your circumstances). An attempted update (/U) isn't considered an error if the files are the same.
Does the /UF option the function in a similar manner? My command is using /UF.

ie: copy /D /F /H /J /K /V /Y /Z /S /MD /UF "o:\Test\" "d:\Projects\Test\"
 

rconn

Administrator
Staff member
May 14, 2008
12,367
150
Does the /UF option the function in a similar manner? My command is using /UF.

ie: copy /D /F /H /J /K /V /Y /Z /S /MD /UF "o:\Test\" "d:\Projects\Test\"

No, /UF does not turn off the "file not found" error, though perhaps it should. I've added it to the list for a future version.

Are you actually still copying to/from FAT volumes?
 
Similar threads
Thread starter Title Forum Replies Date
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
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
C How to? COPY ftp folder query Support 7
R How to? TCC 16.03: copy a file to the clipboard? Support 10
jadaml Documentation Is COPY realy doesn't work for any HTTP and FTP? Support 3
T TCC control-C copy operation Support 3
Jay Sage Ctrl-C Not Working Reliably to Copy Screen Content Support 4

Similar threads