Announcement

Collapse
No announcement yet.

Check for an existing directory

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Check for an existing directory

    Greetings --

    Is there a procedure, function or variable that checks for the existance of a directory - for example, C:\TEMP ??

    If yes to any or all, would need a return value to invoke creation of a directory unless it already exists.

    Thanx-A-Lot and God Bless Vespucci-Land,
    Frank -- Please Visit My Humble Abode



    [This message has been edited by Frank Ferrell (edited September 23, 2001).]

  • #2
    Greetings Frank!

    Frank:
    Is there a procedure, function or variable that checks for the existance of a directory - for example, C:\TEMP ??
    Kind of. In the file "dosunit.bas" found with the installation of PowerBASIC there is a cool FUNCTION called Exist. I wrote a little program to showcase it.

    Code:
    $include "pb35.inc"
         
    Test$="c:\temp"
         
    if Exist(Test$) = -1 then       'Found!
         
    elseif Exist(Test$) = 0 then    'Not found, create directory
     mkdir Test$
    end if
    I'm actually quite pleased with some of the source code I've been finding with the installation of PB.


    ------------------
    Don Ewald
    mailto:[email protected]ndless.com[email protected]</A>
    Donnie Ewald
    [email protected]

    Comment


    • #3
      Greetings and Thanx Don --

      The EXIST feature works just as you said. I'm a little shocked and embarassed that I didn't find it beforehand, as I've used Powerbasic DOS for six years now!




      ------------------
      Thanx-A-Lot and God Bless Vespucci-Land,
      Frank Please visit My Humble Abode

      Comment

      Working...
      X