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

How to use isfile

Discussion in 'T&T - Scripting' started by rawood11, Oct 3, 2008.

  1. rawood11

    Joined:
    Oct 2, 2008
    Messages:
    19
    Likes Received:
    0
    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. Jim Cook

    Joined:
    May 20, 2008
    Messages:
    605
    Likes Received:
    0
    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. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    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
     

Share This Page