Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 556665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:56:37+00:00 2026-05-13T11:56:37+00:00

I have some code which I found online and it’s working great. It lists

  • 0

I have some code which I found online and it’s working great. It lists any files in a specified folder and their properties. I just need to amend this function which returns a list of files. I need it to look in a given path at ALL files. So if it’s a folder, open it and return those files too. I eventually need to get this to mark each file (so in a column in excel) where it came from. If it would be possible to create a hirarchy somehow that would be great…. but for now, just opening a folder if it finds on and listing those files would be awesome!

Any help is REALLY appreciated!

Private Function fcnGetFileList(ByVal strPath As String, Optional strFilter As String) As Variant
'   Returns a one dimensional array with filenames
'   Otherwise returns False

Dim f As String
Dim i As Integer
Dim x As Integer
Dim FileList() As String

    If strFilter = "" Then strFilter = "*.*" 'can provide an extension to check?

    'set the path
    Select Case Right$(strPath, 1)
     Case "\", "/"
         strPath = Left$(strPath, Len(strPath) - 1)
    End Select

    ReDim Preserve FileList(0)

    f = Dir$(strPath & "\" & strFilter)

    Do While Len(f) > 0
        ReDim Preserve FileList(i) As String
        FileList(i) = f
        i = i + 1
        f = Dir$()
    Loop

    If FileList(0) <> Empty Then
        fcnGetFileList = FileList
    Else
        fcnGetFileList = False
    End If

End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:56:38+00:00Added an answer on May 13, 2026 at 11:56 am

    Ideas:

    Add the microsoft scripting runtime And use the file system object (much better file/folder handling)

    Make this function recursive, add a vbdirectory parameter to the dir function, and use GetAtrr to get info about each file. If the file is a folder again, call this function again with this new folder.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 314k
  • Answers 314k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yeah, that's a bug (feature?) in IE. If you apply… May 13, 2026 at 11:03 pm
  • Editorial Team
    Editorial Team added an answer This is not the correct MFC source code, have you… May 13, 2026 at 11:03 pm
  • Editorial Team
    Editorial Team added an answer For me this line $(this).parent().next().find("input").val(data["client_id"]); looks a bit dubious. You… May 13, 2026 at 11:03 pm

Related Questions

I need to implement 256 bit AES encryption, but all the examples I have
I recently started using Eclipse at work for my Java servlet projects. I've been
I'm currently using a homegrown method to run a process as a different user
I'm looking for a script or application that tidies up and reformats SQL queries.
First off, the mousewheel event is not listed in Visual Studio 2008's events pane

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.