WAD EXCEPT?

#1
I don't know what went wrong below, but the error message looks suspicious, and CLEAN.BTM was deleted, contrary to my wishes.

Code:
t:\> except clean.btm del *
TCC: (Sys) The system cannot find the file specified.
 "lean.btm"
T:\* : Are you sure (Y/N)? Y
Deleting T:\clean.btm
 
#2
OK ... my fault ... bad syntax.

But a usage error (as in v16) would have been better.
Code:
v:\empty> ver

TCC  16.03.55  Windows 7 [Version 6.1.7601]

v:\empty> except x.cmd del *
Usage : EXCEPT [/I] (file) command
 

rconn

Administrator
Staff member
May 14, 2008
10,493
94
#3
I don't know what went wrong below, but the error message looks suspicious, and CLEAN.BTM was deleted, contrary to my wishes.

Code:
t:\> except clean.btm del *
TCC: (Sys) The system cannot find the file specified.
"lean.btm"
T:\* : Are you sure (Y/N)? Y
Deleting T:\clean.btm
PIBCAK error - you're missing the enclosing quotes.

And you should never use EXCEPT for an internal command -- it's strictly for externals.
 
#6
And "strictly for externals" ... since when? EXCEPT's help gives examples of using it with ERASE and COPY.
I am with vefatica on that one. The number of utterances from Rex about stuff that we should or shouldn't do which turn out to be in direct contradiction to the help is alas not zero. In addition, the way in which Rex deals with such queries seems to me at times unnecessarily arrogant. YMMV of course.

Quote from the current help file, my highlight:
EXCEPT provides a means of executing a command on a group of files and/or subdirectories, and excluding a subgroup from the operation. The command can be an internal command or alias, an external command, or a batch file.
 
#7
Since about 10 years ago, when exclusion ranges were added for internal commands. They will always work; EXCEPT will only occasionally work with COPY and DEL, depending on what other options you have specified.
I rewrote the BTM to use an exclusion range. That works fine. But I have to admit that, though I tested ranges when they were new, they never became a way of life ... I just don't need that sort of thing often. On the other hand, EXCEPT goes back 25+ years to a time when it was humanly possible to know all the product (then, 4DOS) could do. EXCEPT was the first thing I thought of for the job of deleting all files but one. And it worked fine after I got the syntax right. I still think it should produce a usage message when the parentheses are missing (as it used to do).
 

rconn

Administrator
Staff member
May 14, 2008
10,493
94
#8
From the help for EXCEPT:

--------------------------
Caution: EXCEPT will not work with programs or commands that ignore the hidden attribute or which work explicitly with hidden files, including DEL /Z, and the /A:H or /H (process hidden files) switches available in internal file processing commands.

File exclusion ranges provide a faster and more flexible method of excluding files from internal commands, and do not manipulate file attributes, as EXCEPT does. However, exclusion ranges can only be used with internal commands; you must use EXCEPT for external commands.
--------------------------

This is why exclusion ranges were created -- people were doing things like "EXCEPT (all_my_important_files) del *", and forgetting that they had aliased DEL to DEL /H.
 
#10
Sooner or later, using EXCEPT with internals like DEL will hurt you badly. And with some internals, EXCEPT has no effect at all.
It was the first time I used EXCEPT in many years. My clean_the_temp_directory script had a;list;of;extensions a mile long just to avoid deleting the BTM itself ... and I like tweaking things. I'm happy with the exclude list.