+ Reply to Thread
Results 1 to 4 of 4

Retrieve Filenames From Directory

  1. #1
    Forum Expert kersplash's Avatar
    Join Date
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)

    Retrieve Filenames From Directory

    I have a large number of files contained in a folder and subfolders.

    I need to get a list of the filenames and the date created that were created between two dates, that also contain certain text in their filename.

    I created a power query successfully to do this, but because there are so many files, Excel is not usable when the query is being run and eventually crashes with an ambiguous error.

    Is there an alternative way to do this task without Excel?

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    Steamboat Springs
    MS-Off Ver
    MS Office 365 Win 11 Home 64 Bit

    Re: Retrieve Filenames From Directory

    Here is some code that you can adapt for the date created. Change up one of the variables to

    Please Login or Register  to view this content.

    Have you debugged your code?
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert
    Join Date
    drevni ruchadlo
    MS-Off Ver

    Re: Retrieve Filenames From Directory

    Variant 2 - Use 'Dir' (with parameters) in 'cmd' to create a 'txt' file (in conjuction with 'CreateObject("Wscript.Shell")'), import data from file to memory, process data and copy the results to the sheet.
    Last edited by mjr veverka; 03-28-2019 at 05:56 AM.

  4. #4
    Registered User
    Join Date
    MS-Off Ver

    Re: Retrieve Filenames From Directory

    You can automate this task using a python script. I prefer to work with Python because it is a very flexible programming language, and allows me to interact with the operating system easily. This also includes file system functions. To simply list files in a directory the modules os, subprocess, fnmatch, and pathlib come into play.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 16
    Last Post: 08-09-2015, 08:17 AM
  2. Retrieve Active Directory OU by user name
    By seanpears99 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-06-2013, 09:48 PM
  3. [SOLVED] When opening book, write all filenames of the directory to cells
    By nivoe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-08-2012, 11:55 AM
  4. Retrieve data from a series of worksheets in a directory
    By wahlberg in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-27-2012, 10:08 AM
  5. Looping through all Workbooks in directory to retrieve rows of information
    By TechUseless in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-03-2008, 04:40 PM
  6. retrieve filenames from given directory into excel
    By giel.vanboxtel@nextprint.nl in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 06-06-2006, 01:20 PM
  7. Parse Directory Filenames
    By chrisjnorskov in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2005, 07:56 AM


Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1