Announcement

Collapse
No announcement yet.

Checking To See If File Is There

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

  • Checking To See If File Is There

    Looking for a simple routine to confirm if a file is present or not, and delete it if is there.. Is there a simple command to do this under PB3.5??

    John

    ------------------

  • #2
    fi$ = "somefile.txt"
    te$ = dir$(fi$)
    if te$ <> "" then kill fi$


    ------------------
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      Wow.. Much easier than I expected.. Appreciate it very much..

      john

      ------------------

      Comment


      • #4
        I forgot to add:
        In this case, be sure to kill FI$ and not TE$. FI$ will (should)
        contain the full path whereas TE$ will only contain the file
        name. If you are in a different sub-directory, you'll get a
        "file not found" error message or delete a file you may not want
        deleted.


        ------------------


        [This message has been edited by Mel Bishop (edited February 16, 2002).]
        There are no atheists in a fox hole or the morning of a math test.
        If my flag offends you, I'll help you pack.

        Comment


        • #5
          Also check out the EXIST function in DOSUNIT.BAS in the \PB\EXAMPLE folder...


          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment

          Working...
          X