1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WAD EXCEPT?

Discussion in 'Support' started by vefatica, May 14, 2016.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    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. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    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
     
  3. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,026
    Likes Received:
    84
    PIBCAK error - you're missing the enclosing quotes.

    And you should never use EXCEPT for an internal command -- it's strictly for externals.
     
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    I realized that (see my second post). But it should have given a usage error as in v16.

    And "strictly for externals" ... since when? EXCEPT's help gives examples of using it with ERASE and COPY.
     
  5. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,026
    Likes Received:
    84
    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.
     
  6. charles_perrin

    Joined:
    Nov 7, 2015
    Messages:
    9
    Likes Received:
    0
    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. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    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).
     
  8. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,026
    Likes Received:
    84
    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.
     
  9. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,026
    Likes Received:
    84
    Sooner or later, using EXCEPT with internals like DEL will hurt you badly. And with some internals, EXCEPT has no effect at all.
     
  10. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,060
    Likes Received:
    30
    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.
     

Share This Page