all files in one directory 
Author Message
 all files in one directory

Hi,

my problem is :
I want to get all files that match e.g. C:\WINDOWS\WIN*.INI into one
array, but I have no idea how to do it.
Any help, code or whatever would be appreciated.

Thanks,

John



Sun, 23 Sep 2001 03:00:00 GMT  
 all files in one directory

Quote:
>I want to get all files that match e.g. C:\WINDOWS\WIN*.INI into one
>array, but I have no idea how to do it.

Hi John,

    Here's one way to do it.

Sub Main()

    Dim lCount As Long
    Dim szFileArray() As String
    Dim szFile As String

    ''' Make plenty of room in the array.
    ReDim szFileArray(0 To 1000)
    lCount = 0
    szFile = Dir$("c:\windows\win*.ini")

    Do While Len(szFile) > 0
        szFileArray(lCount) = szFile
        szFile = Dir$()
        lCount = lCount + 1
    Loop

    ''' Resize the array to fit the files found.
    ReDim Preserve szFileArray(0 To lCount - 1)

    ''' Display the contents of the array.
    For lCount = LBound(szFileArray) To UBound(szFileArray)
        Debug.Print szFileArray(lCount)
    Next lCount

End Sub

--
Rob Bovey, MCSE
The Payne Consulting Group
http://www.payneconsulting.com
* Post follow up questions to this newsgroup *
* I do not respond to questions sent via e-mail *



Sun, 23 Sep 2001 03:00:00 GMT  
 all files in one directory

Quote:
>Hi,

>my problem is :
>I want to get all files that match e.g. C:\WINDOWS\WIN*.INI into one
>array, but I have no idea how to do it.

Check out my FileLister sample at
http://www.zebra.net/~adrianm/pages/samples.htm

HTH,

;-) Cool
Hasta Luego
Adrian Maull, MCSD



Sun, 23 Sep 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. - Importing all text files from one directory... -

2. Copying files from one directory to another

3. Moving Files from one directory to another

4. Copying files from one directory to another?

5. Copying files from one directory to another

6. All files of one directory

7. How to copy files from one directory to another ?

8. How to get a listing of files from one directory and store to an array?

9. File/Dit List of one directory

10. How to figure out which file in a directory is the oldest one

11. Changing One File name in a directory using VB

12. Returning all file names from given folder directory and all sub-directories

 

 
Powered by phpBB® Forum Software