Results 1 to 2 of 2

Thread: Dir

  1. #1
    bzemer
    Guest

    Dir

    Hello,
    I keep forggeting this..
    if i want my program to look for a directory called 'docs', that exist in the path of the app (app.path), and i want the program to tell this:
    if the dirextory exist then go on, else if it exist but empty do some stuff or if it doesn't exist recreate it.

    How do i do it?
    i keep getting the DIR function all wrong and i can't find out what i intended..

    thanks..

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946
    Code:
    Private Sub Command1_Click()
    
    Dim stFile As String, stDir As String
    
    stDir = App.Path & "\docs\"
    stFile = Dir$(stDir & "*.*")   'all files
    
    If Dir(stDir, vbDirectory) <> "" Then
     'if the dir exists
       If stFile = "" Then
         'no files in dir so do something
          MsgBox "No Files"
       Else
         'whatever
          MsgBox "Files"
       End If
           End If
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width