Re: "FFIND" Exit Codes?



Steve Fabian (ESFabian@xxxxxxxxxxx) wrote:
Richard Bonner wrote:

| Richard Bonner (ak621@xxxxxxxxxxxxxx) wrote:
|| 4DOS 7.61
|
|| I wish to have FFIND look for files witn the "Archive" attribute
|| and to issue exit code `0' if it finds any, `1', if it does not.
|
|| Richard Bonner

| *** Sorry to be a pain, but I still cannot get this to work. The
| relevant batch file section is:
|
| FFIND /A:+A *.*
| IF ERRORLEVEL 1 GOTO NO-NEW-FILES
| IF ERRORLEVEL 0 GOTO BACKUP
|
| The errorlevel `0' is always the result. )-: I tried various
| error-level testing suggestions given in this thread but the result
| was always the same. Theoretically, if I clear all "Archive"
| attributes in that directory, should not the exit code be `1' ?

FFIND is an internal command. The internal commands which duplicate some
CMD.EXE / COMMAND.COM feature often do return an ERRORLEVEL. However, it is
quite possible that FFIND never sets the errorlevel.

*** That is unfortunate. I had always thought that 4DOS had a full set
of exit codes for every command, but never had a need to use them until
now. (I use 4DOS as a secondary shell and incorporate it as needed.)


Try testing the exit code designed for internal commands, _?. It may give
you the information you desire.

*** OK. Thanks.


BTW, if you are using FFIND just to determine whether or not any files with
attribute A are present in a single directory, you can use the @FILES[]
function:

if %@files[*.*,A] gt 0 goto HAVE_NEW
--
HTH, Steve

*** Excellent! That would be what I require.


Thanks for the help.

Richard Bonner
http://www.chebucto.ca/~ak621/DOS/
.



Relevant Pages

  • Re: "FFIND" Exit Codes?
    ... || and to issue exit code `0' if it finds any, `1', if it does not. ... | IF ERRORLEVEL 1 GOTO NO-NEW-FILES ... | Could someone provide the syntax to check the FFIND exit codes as ... FFIND is an internal command. ...
    (comp.os.msdos.4dos)
  • Re: "FFIND" Exit Codes?
    ... ||| Does anyone know the exit codes for FFIND? ... | IF ERRORLEVEL 1 ECHO NOT FOUND ... echo external exit code was 0 ...
    (comp.os.msdos.4dos)
  • Re: Xcopy behavior questions
    ... The following list shows each exit code and a brief description of its ... from Dos 6.22 help file which is the best reference for exit codes. ... > I used %errorlevel% in MS-DOS 5. ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: System.Diagnostics.Process / .BAT file / always returns exit code 0
    ... distinguishing DOS "errorlevel" vs. process return code. ... to suspect that if I set "errorlevel" in a .BAT file, ... Good suggestion on writing a program to return the exit code; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Xcopy behavior questions
    ... The following list shows each exit code and a brief description of its ... The user pressed CTRL+C to terminate XCOPY. ... from Dos 6.22 help file which is the best reference for exit codes. ... > I used %errorlevel% in MS-DOS 5. ...
    (microsoft.public.win2000.cmdprompt.admin)