How to? max. practical command line length?

Dec 10, 2014
63
1
#1
The help says that there is no max command line length with tcc, and I'm wondering how the "soft" limits are.

For example: I want to delete a lot of named files from a directory, like...

del a1.jpg
del b2.jpg
del c3.jpg
del d4.jpg


... which can be turned into one line which seems to be faster(?) ...

del a1.jpg b2.jpg c3.jpg d4.jpg

Question: When should I switch to using another del command - with 10 files, 100, 1000, 10000, ...? Is the limit the resulting command line length or the # of arguments?
 

rconn

Administrator
Staff member
May 14, 2008
10,506
94
#2
TCC has no limit (other than available RAM) for the command line. If you're running x86 Windows you'll hit the limit sooner or later; with x64 you're unlikely to ever run out.

There are some Windows APIs that will gag on a really long command line, but in the case of your DEL example, it doesn't matter whether you put them on one line or multiple ones, because TCC ends up calling the Windows delete file API once for each file. Switch to another DEL command when you lose track of what you're doing.
 

samintz

Scott Mintz
May 20, 2008
1,272
11
Solon, OH, USA
#3
Depending on how you are obtaining the list of files to delete, you can use RegEx names to do a wildcard delete. Or use DIR plus an editor to fine tune the list and use an include list (del @file.lst). Or you can use a wildcard delete with the prompt switch (del /p *).

Or numerous variations of filters and pipes.

For example, to delete all the view private files from a snapshot view in ClearCase:
Code:
DO f in /p (cleartool ls -recurse -view -visible | sort -r) (if ISFILE %f (del /z %f) else (rm %f))
 
Likes: Juppycmd
Dec 10, 2014
63
1
#4
Or use DIR plus an editor to fine tune the list and use an include list (del @file.lst).
Thanks, I didn't know that one, I'll see how it performs vs. multiple files on the command line.

There are some Windows APIs that will gag on a really long command line, but in the case of your DEL example, it doesn't matter whether you put them on one line or multiple ones, because TCC ends up calling the Windows delete file API once for each file.
I dunno - with my system (Win10 x64 LTSB 2016) having multipe files on one del command line is significantly faster than using multiple del with one file each. Maybe Windows pools the files into one batch, or the sata command queuing kicks in. What I'm doing is trying to delete a large list of individually named files (that might exist or not) from a ntfs directory with a lot of existing files (like 50.000).

Probab the same reason while copying multiple files with tcc (esp. w/o /q param) takes ages vs. dedicated utils like FastCopy or TeraCopy that pool the files.