Consulting

Results 1 to 3 of 3

Thread: Solved: Return all file names in a folder

  1. #1

    Solved: Return all file names in a folder

    Anyone know how to import all of the file names in a folder into an array?

    Here's what I'd like to be able to do:

    for the following folder 'c:\test' the contents are:
    file1.txt
    file2.txt
    file3.txt


    I'd like to be able to check the file contents of c:\test\ and somehow have the three filenames written into an array (as strings). First the script needs to count the number of files in the folder and then loop through each file name so that it can write each name into the array. I'll then do some string manipulation to check that certian files are present in the folder before starting a secondary process.


    I've been reading up on the FileSystemObject but I'm afraid I haven't figured out how to use that object to figure this out.

    Any help would be appreciated. I feel like this shouldnt be very hard to do, i just dont know what functions to use.

    Thanks!

  2. #2
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    This kb article from mdmackillop shows how you can loop through all files in folders and subfolders. You could adapt this to your needs.
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  3. #3
    That's a nice little chunk of code, that'll do the trick nicely. I'm liking it alot!

    Thanks for the help!

Posting Permissions

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