CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Procedue

  1. #1
    Join Date
    Feb 2000
    Location
    Thailand
    Posts
    5

    Procedue

    Can someone help me to explain this procedue?

    DoEvents
    TmpDir = Dir(DrivePath, vbDirectory)

    Do While TmpDir <> ""

    If TmpDir <> "." And TmpDir <> ".." Then

    If (GetAttr(DrivePath & TmpDir) And vbDirectory) = vbDirectory Then
    XDir(DirCount) = DrivePath & TmpDir & "\"
    DirCount = DirCount + 1
    ReDim Preserve XDir(DirCount) As String
    End If
    End If
    TmpDir = Dir
    Loop
    'Searches for the files given by extensi
    ' on Ext
    FFound = Dir(DrivePath & Ext)


    Do Until FFound = ""
    DrivePath
    FFound = Dir
    Loop
    For X = 0 To (UBound(XDir) - 1)
    FilesSearch XDir(X), Ext
    Next X



  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Procedue

    to me that looks like a sub that searches all directories for files of a given extension.

    the first part

    TmpDir = Dir(DrivePath, vbDirectory)

    Do While TmpDir <> ""

    If TmpDir <> "." And TmpDir <> ".." then

    If (GetAttr(DrivePath & TmpDir) And vbDirectory) = vbDirectory then
    XDir(DirCount) = DrivePath & TmpDir & "\"
    DirCount = DirCount + 1
    ReDim Preserve XDir(DirCount) as string
    End If
    End If
    TmpDir = Dir
    Loop



    stores all subdirectories within a directory in a dynamic array XDir.

    The second part

    FFound = Dir(DrivePath & Ext)


    Do Until FFound = ""
    DrivePath
    FFound = Dir
    Loop



    searches for all files of a given extension in a single directory and calls a function DrivePath for each file found.

    The third part

    for X = 0 to (UBound(XDir) - 1)
    FilesSearch XDir(X), Ext
    next X





    iterates over all subdirectories and calls a FilesSeach function for each subdirectory.






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

Featured