TCC v12.10 COPY /F does not work

May 16, 2011
22
0
I have not been able to get COPY to stop creating empty directories at the destination, even though I specify /F using the batch file shown here:

Code:
@REM                F:\BACKUP\TESTZERO.BTM             30-May-11   09:28:29am   
@REM                ----------------------                                      
@REM
@REM -- Archives Drive D to folder \Drive_D\ on Drive J
@REM -- Creates a bunch of empty directories, even though we specify /F
@VER
@COPY /B /E /K /M /S /F /X /Z    D:\*.*    %1:\Drive_D\

I formatted a USB thumb drive and plugged it in, where it became Drive J. Then I went to the folder containing TestZero.BTM, and typed "TestZero.BTM J". TCC then identified itself as v12.10 and then proceeded to create a gazillion empty folders on Drive J even though I told it not to via /F. <grrrr> Note that TCC did not copy any files at all, because none of the files on my Drive D has the Archive attribute set at this time. Perhaps that is key.

-- Nick
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,461
88
Albuquerque, NM
prospero.unm.edu
I don't know whether that constitutes a bug or not. (Does "empty" mean "containing no files," or does it mean "containing no files eligible to be copied"? The documentation is not clear.)

But for cleanup purposes, you can remove all empty directories under C:\TARGETDIR with a command like:

Code:
del /s /e /x /y /q c:\targetdir\nul

If there are no files at all in C:\TARGETDIR or any of its children or descendants, the above will remove C:\TARGETDIR itself -- this may or may not be what you want. You can prevent C:\TARGETDIR from being removed by doing a PUSHD C:\TARGETDIR before and a POPD after; TCC can't remove the current directory.
 

rconn

Administrator
Staff member
May 14, 2008
12,344
149
I have not been able to get COPY to stop creating empty directories at the destination, even though I specify /F using the batch file shown here:

You cannot use COPY /F that way. If you're doing conditional copies with a /S, COPY has to create the subdirectory first in order to do the test. And COPY cannot tell whether the source directory has more subdirectories (in which case it must create those subdirectories as well) until it has finished processing filenames and then looks for directories.

The only way COPY could do this would be to convert it to a 2-pass system, which would be MUCH slower than the current approach. (And slower than doing the COPY and then doing a DEL /X of the empty directories.)
 
May 20, 2008
3,515
4
Elkridge, MD, USA
From: rconn
| The only way COPY could do this would be to convert it to a 2-pass
| system, which would be MUCH slower than the current approach. (And
| slower than doing the COPY and then doing a DEL /X of the empty
| directories.)

Since COPY followed by DEL is a 2-pass system, when performed manually, is there a reason why it could not be the implementation of the /F option, other than the issue of preexisting empty directories in the target, which remain empty?
--
Steve
 
May 20, 2008
3,515
4
Elkridge, MD, USA
From: Charles Dye
| From: rconn
|| (And slower than doing the COPY and then doing a DEL /X of the empty
|| directories.)
|
| This works, of course, but it's not very obvious. Would it make sense
| to have an option to RD, say RD /E, which recursively removes only
| empty directories from the inside out?

The command "*del/q/y/x/s/net/a:d" deletes all directory hierarchies which contain no files. There is no need to duplicate it via a new RMDIR option.
--
Steve
 
May 16, 2011
22
0
>(Does "empty" mean "containing no files," or does it mean "containing no files eligible to be copied"? The documentation is not clear.)

Eligibility is a source consideration; I want it to stop creating empty directories at the destination.

The documentation is not clear? Here it is, verbatim, from the TCC v12.10 Help, via cut and paste:

/F When used with /S, COPY will not create any empty subdirectories.

What part of "will not create any empty subdirectories" are you claiming is unclear? I am an electrical engineer, not an English major, but I claim I can read real good. :-) Far as I am concerned, there ain't anything unclear about the claim. What it is, is FALSE.

Thank you, Charles, for the one-liner to remove the empty directories after-the-fact, even though I would never use it (Del is way too dangerous). Besides, we should be talking about PREVENTING these things, not continually mopping them up.

Hmmm, say, I've just now dreamed up a saying to cover this situation:

"An ounce of prevention is worth a pound of cure".

-- Nick
 
May 16, 2011
22
0
>If you're doing conditional copies with a /S, COPY has to create the subdirectory first in order to do the test.

The only thing conditional is at the source (does the source file have its Archive bit set?) This test in NO WAY requires first creating a destination path.



>The only way COPY could do this would be to convert it to a 2-pass system

Rex, it ain't 1981 anymore. :-) I am typing this on a 2nd gen Core i7 with 8 gigs of DRAM and an Intel SSD. This thing is so FAST it comes up with answers before I can type the questions! Anyway, on even my very slowest machine (a netbook with an Atom CPU), I don't care how many passes COPY makes in order to do the job right. It can take 17 passes if it likes, just so long as it does not create spurious directories.

Here is how I would do it (in one pass): FindFirst/FindNext to get the next candidate, and check the eligibiity of said candidate. If eligible, optimistically COPY the file to the destination with a full path specification. If no error, be happy. If encounter "no such path" error, then create the path and then copy the file. Done.

-- Nick
 
Similar threads
Thread starter Title Forum Replies Date
mikea TCC v12 startup questions Support 15
B TCC v12 display double problem Support 2
J TCC/TCMD V12 expired Support 4
K_Meinhard TCC LE V12 problem with registering Support 1
MickeyF TCC crashing when copying multiple files (now resolved) Support 6
C COMSPEC constantly reset to TCC.EXE Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT v28 Released Support 0
C How to? starting TCC/TCMD v25 Support 2
CWBillow TCC and TCMD in Powershell Support 6
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.24 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.01.23 uploaded Support 0
Alpengreis Fixed Crash after copy dialog with big TCC.exception.log Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT v27.01 Build 22 Uploaded Support 0
L FTYPE in TCC, less quirky than in cmd.exe Support 3
V Set path permanently from within TCC? Support 3
DrusTheAxe Runaway TCC.exception.log filling drive Support 5
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.21 uploaded Support 0
Joe Caverly tcc.exception.log Support 3
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.20 uploaded Support 0
rconn News Take Command / TCC / CMDebug / TCC-RT 27.0.19 Support 0
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
vefatica SCRIPT ... TCC disappears Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT v27.0.18 Support 0
Jesse Heines Access Denied errors in TCC 27 Support 9
fpefpe How to? tcc inifile (%_ininame) Support 3
M How to? Black TCC Prompt Support 2
D Differences between TCC and CMD with COPY /b Support 4
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
Jay Sage Extra TCC Tasks Support 6
vefatica Can I turn off the minimize to tray mechanism in TCC? Support 5
N Command execution slows down in TCC Prompt after a while Support 6
R Upgrade TCMD 19 to TCC 26 Support 1
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
samintz How to? Is this doable in TCC? Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT 26.02.41 Uploaded Support 0
D TCC tab detaching & restarting Support 3
Ó Recent git output not shown on TCC Support 1
P Kill all other instances of tcc from a btm batch file Support 2
L Using TCC.exe through an SSH connection Support 3
M TCC color issue in ConEmu Support 4
Alpengreis UTF-8 problem in TCC related to Python Support 7
Alpengreis Python support for 3.8.3 in TCC v26.x? Support 2
rconn News Take Command / TCC / CMDebug / TCC-RT 26.01.40 uploaded Support 0
Peter Murschall TCC V26.01.3x Debugging has problems with Alias /R Support 1
rconn News Take Command / TCC / CMDebug / TCC-RT 26.0.37 Uploaded Support 0
vefatica TCC waits for Office apps Support 4
Joe Caverly .BAT works in TCC-RT 25, but not in TCC-RT 26 Support 4
M Strange error messages from TCC in FTP copy Support 7
Kachupp Documentation tcc-rt versions Support 1
V Comments from a first-time user (TCC 26) Support 6

Similar threads