Text listing of File Folder Contents

  • Thread starter Thread starter Chip
  • Start date Start date
C

Chip

Hey Everyone,

I'm not really sure where this question fits in but since I use Access
as my main vehicle, I'll start here. What I'm currently doing is
archiving our paperwork, on my way to turn my office completely
paperless (or at least as much as I can).

I have paperwork for each customer that is scanned into a network
drive. After I scan them, I then go in and rename the paperwork with
the customers name. It looks like this

Lastname, Firstname.pdf

What I want to do is get a list of file names, by using a Query in
access. All I need is the text, but I can quite figure how to make
that happen. What is the best approach here?

Eventually, these files will be linked to the transaction for each
customer, but I wanted to start here first..

chip
 
Well, if you only want to do it once, you can do it like this:

At the Start > Run command line, type:
cmd /c dir "C:\YourFolderPath\" /a:-d /b >"c:\myfiles.txt"

Replace your actual folder for "C:\YourFolderPath\". This will create a
text file called "myfiles.txt" in the root of your C: drive with a list of
all the file names in that folder. You can then import that text file into
an Access table through the normal text import process (File > Get External
Data > etc).

On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "DirectoryList.mdb" which automates this process. You can
download it for free here:
http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=353

This is actually an old-fashioned method, developed before Windows file
scripting was available, but it works for me.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
On Fri, 9 Oct 2009 06:50:49 -0700 (PDT), Chip

You may want to re-think that. For example what would happen if we
receive a second piece of paperwork from the same customer? Or if you
ever will have two customers "Jones, Jim"?

I would consider having Access deal with the filenames: they can be
autonumbers for all I care, as long as Access has indexed them
properly and you can find any file via this indexing table.

tblFiles
FileID PK autonumber
FileName unique index
CustomerID FK

tblFileKeywords
FileID FK
Keyword text

I would not use absolute file paths, but a relative path off some
"root" folder.

-Tom.
Microsoft Access MVP
 
Back
Top