Announcement

Collapse
No announcement yet.

File Exists fn

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

  • #21
    Originally posted by Mike Burgett:
    Kurt,

    This is what I use to determine if a file exist:


    FILE$ = "F:\public\FileName.Dat" 'Path and File name here
    x$ = DIR$(file$) 'Look for File

    IF x$ = RIGHT$(file$,12) THEN 'Check just the name for match
    Indicator = 1 'True
    ELSE
    Indicator = 0 'False
    END IF



    Hope this helps.

    This would only detect files that are exactly in 8.3 format, no shorter!
    It's much safer to check for failure and compare the result of DIR$ with an empty string...

    Also keep in mind when you use DIR$ that it overwrites your previous DTA information, so
    you cannot use it inside another DIR$ loop. The PB example saves and restores this DTA...

    ------------------
    Sebastian Groeneveld
    mailto:[email protected][email protected]</A>
    Sebastian Groeneveld
    mailto:[email protected][email protected]</A>

    Comment

    Working...
    X