How to use isfile

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Oct 2, 2008
19
0
#1
How can I use isfile within a .btm file to check for the existence of another file and branch to true or false alternative logics?
 
#2
> How can I use isfile within a .btm file to check for the existence of another file and branch to true or false alternative logics?
Here are a couple of examples.

echo Test file > NewFileName.TXT
if ISFILE NewFileName.TXT (
echo Test case 1 exists
) else (
echo Text case 1 does not exist
)
if ISFILE DoesNotExist goto itexists
echo Test case 2 does not exist
quit

:itexists
echo Test case 2 exists
quit



--
2008 Fridays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Saturday.
Measure wealth by the things you have for which you would not take money.
 
#3
JP Software Forums" <neil@jpsoft.com>; "Jim Cook wrote:
| ---Quote---
|| How can I use isfile within a .btm file to check for the existence
|| of another file and branch to true or false alternative logics?
| ---End Quote---
| Here are a couple of examples.
|
| echo Test file > NewFileName.TXT
| if ISFILE NewFileName.TXT (
| echo Test case 1 exists
| ) else (
| echo Text case 1 does not exist
| )
| if ISFILE DoesNotExist goto itexists
| echo Test case 2 does not exist
| quit
|
| :itexists
| echo Test case 2 exists
| quit

My preference is IFF / ELSE / ENDIFF:

iff isfile whatever.file then
.. process whatever.file
else
echo whatever.file does not exist
endiff

--
Steve