Except chokes on files with right parens

Jul 7, 2008
20
1
If you try to specifically 'exclude' a file that has a right parenthesis in its filename, it appears that the exclude code treats the parenthesis as the closing paren for the exclusion list. For example:

> except (test(1.2).txt) dir *
TCC: Unknown command ".txt)"

Even putting the filename in quotes fails, with a slightly different output:

> except("test(1.2).txt") dir *
TCC: Unknown command ".txt) dir *"

(edit: this is on "TCC 15.01.51 x64 Windows 7 [Version 6.1.7601]")
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,493
91
Albuquerque, NM
prospero.unm.edu
That is odd. Escaping the close pat doesn't seem to help, either. Perhaps you can use a question mark as a temporary workaround...?

For internal commands, I recommend that you use an exclusion range instead of EXCEPT. EXCEPT is really only there for the benefit of external commands. (Maybe you just picked DIR for purposes of illustrating the issue, in which case please disregard this comment.)
 

rconn

Administrator
Staff member
May 14, 2008
12,404
152
If you try to specifically 'exclude' a file that has a right parenthesis in its filename, it appears that the exclude code treats the parenthesis as the closing paren for the exclusion list. For example:

> except (test(1.2).txt) dir *
TCC: Unknown command ".txt)"

Even putting the filename in quotes fails, with a slightly different output:

> except("test(1.2).txt") dir *
TCC: Unknown command ".txt) dir *"

The first example is invalid syntax is wrong; the embedded '(' doesn't mean anything to the parser, so it terminates on the first ')' it finds.

The second example should have worked -- except that EXCEPT is (99.9%) obsolete, and hadn't been updated since DOS (where double quotes didn't mean anything either). I have made a change for the next build (15.01.52) which will ignore embedded )'s within double quotes.
 
Jul 7, 2008
20
1
The first example is invalid syntax is wrong; the embedded '(' doesn't mean anything to the parser, so it terminates on the first ')' it finds.

The second example should have worked -- except that EXCEPT is (99.9%) obsolete, and hadn't been updated since DOS (where double quotes didn't mean anything either). I have made a change for the next build (15.01.52) which will ignore embedded )'s within double quotes.
I'm not quite sure why the first example syntax is wrong; doing a 'dir test(1,2).txt' from a win 7 cmd.exe prompt works fine, so I would expect the same behavior within the exclude block. In any case, I appreciate the fix. I have files with version numbers in parens that are useful for compares/diffs/unit tests and want to exclude them from certain external commands.

[EDIT] I haven't used exclusion ranges much, but they probably are the right solution in most cases for me.

One suggestion: it would be very helpful if the /[=] popup dialog had checkboxes to create exclusions for size/date/owner/etc ranges (ie, prepend the ! operator to these options) and to allow the 'results" textbox at the bottom of the dialog to be fully editable so that a complex range combination can be created and then copied for subsequent use. I would personally prefer that the results then replace the command-line command in situ so that the fully formulated command enters the history list rather than the /[=] command. Perhaps something to think about?

Again, thanks. -- Casey
 

rconn

Administrator
Staff member
May 14, 2008
12,404
152
I'm not quite sure why the first example syntax is wrong; doing a 'dir test(1,2).txt' from a win 7 cmd.exe prompt works fine, so I would expect the same behavior within the exclude block. In any case, I appreciate the fix. I have files with version numbers in parens that are useful for compares/diffs/unit tests and want to exclude them from certain external commands.


A "dir test(1,2).txt" will work fine in TCC too. But it won't work in EXCEPT.

The problem is that there is no reason for the TCC parser to think that a leading '(' has to have a matching trailing ')'. (And yes, I've seen lots of filenames with mismatched parens.) So when you insert the filename into the parenthesized EXCEPT argument, the parser can only assume it should end at the first ')' it finds.
 
Similar threads
Thread starter Title Forum Replies Date
vefatica WAD EXCEPT? Support 9
A How to? Use EXCEPT on files without subdirectories? Support 10
CWBillow File Lists with EXCEPT command Support 7
MickeyF TCC crashing when copying multiple files (now resolved) Support 6
fpefpe How to? shortcuts and batch files Support 4
C v28 key files Support 2
J ffind does not find files Support 4
C duplicate files in multiple plugin sites Support 9
Dmitry L. Kobyakov Fixed The SETARRAY /R command works incorrectly with cyrillic files Support 2
S How to? Deinstalling TC/reinstating execution of bat files by cmd in Win7 Support 31
vefatica FFIND, temp files? ... not deleted? Support 0
R FUNCTION to count NUMBER of files matching a pattern and specific length/not length Support 4
vefatica Tmp files from in-process pipes not deleted Support 6
vefatica Finding files with alternate data streams? Support 4
rps Multi-column DIR /v not displaying all files. Support 5
D How to skip files in a fileset? Support 6
vefatica PIPEVIEW leaves TMP files Support 18
K "copy /z /w" command not deleting read-only files in destination Support 10
Jesse Heines "Taken" date for JPG and PNG files Support 4
O I cannot use links to .btm files Support 5
C How to? rename files with spaces Support 8
R How to? Append files in multiple subfolders using copy? Support 8
Joe Caverly "Functions" in cmd.exe batch files Support 6
S Batch files Calling Batch Files Support 2
vefatica Find Files/Text dialog: does it work? Support 0
Joe Caverly UNZIPping older .ZIP files Support 3
C Documentation default location for LOG files Support 21
P exit /b in batch files Support 7
P Labels in batch files: TCC vs CMD.exe Support 9
M ANSI is used to show files instead of OEM in version 17 to 19 ! Support 5
C 7Z files on forum? Support 0
x13 Problem listing repository files using DIR http(s)://... Support 8
B Can copy command concatenate multiple mp3 files Support 2
redwdc Copying files with spaces, commas, etc. Support 5
J New lexer for TCC batch files. Support 0
M How to? want to download a file from a website enumarate the links and download the files Support 2
keithg1964 TCC RT Install Files Support 1
P Fixed Rexx .cmd files no longer work in TCC 20 Support 3
thorntonpg Handling files with embedded spaces Support 1
WavSlave Fixed Unable to sort files by description in TCC v19 Support 2
P Files older - exist Support 1
D safe delete files command Support 10
P Copying files in subdirectories Support 9
C WAD VIEW print multiple files - switches fail Support 10
MikeBaas How to? SELECT: exclude files / display prompt Support 2
Phileosophos WAD Can't rename files in subfolders Support 1
nickles WAD del unable to delete files ending in "." Support 18
P Rename files with ampersand in the name Support 1
C Touch command — I Need to touch matching files in another directory. Support 5
S iftp copying pgp files from ftp is not working Support 11

Similar threads