PDA

View Full Version : Need help to recursively list files to Access



mandark1967
12-08-2008, 11:24 AM
Hi!

First post here, so be gentle. I performed a normal search and an advanced search on the terms I thought might get me the information I need, but either my terms weren't spot-on or the topic hasn't been covered yet so I am posting my question in hopes of getting some help.

I did see something "similar" to what I am attempting to do, located here at these forums, but it doesn't do what I need.

I have several large shares on my home network that contain about 5TB of data total. It's all the home movies and pictures and stuff for my 60+ member extended family.

From a file management standpoint, it's a little cumbersome to manage that many files for the family so I want to automate the process of gathering the information.

I currently have a rudimentary MS Access 2003 database which I programmed a Macro to change drives to the shared drive I have mapped and calls the DOS command:

Dir /S /N /Q /T:W /4 >d:\MyFiles\Input.txt

That command gives me the following information:
File Name
Size
Last accessed Date/Time
Owner
Full pathname to file

It lists all files and folders from the root of the share recursively so that I get all the files on the drive.

I then take that resulting text file and manipulate the crap out of it to pull the information out and populate several temporary tables that hold the information I need, and it then populates the "final" table with the information above, AND the pathname to each file.

It's a very cumbersome method that takes 25+ clicks of the "ok" button as I am yanking various information out of the text file, putting it into temporary tables, then populating the "real" table from the various tables.

I understand there is a method to pull the information straight from the filesystem(?) to populate the table from within MS Access itself so I do not have to deal with the major manipulation of the DOS text file.

What I want to do is have a button in my MS Access table that calls the filesystem and recursively lists all files and folders on my shared drive to a table, skipping all the DOS crap, and lists the following file & folder information:

File Name
Size
Last Modified Date/Time
Last Accessed Date/Time
Owner
Full pathname to file

I found a great little MS Excel macro that does this for a spreadsheet, but I have too many files (well over 1 million files because I have the photos and movies and stuff for my entire extended 60+ member family)

I found a script at Allen Browne's great site that grabs some of the information but I can't seem to get it to work to grab the rest of the information I need. The date field in his script seem to default to Now() and I get only the file name and path.

It populates the table, but I can't seem to grab the Modified Date, Accessed Date, and Owner information. I really need that extra information to determine when files can be archived to DVD and sent to my relatives because I am running out of disk space, lol.

Can I get some assistance on making the script grab the rest if the information I need, please? I'm not allowed to post the link because I don't have 5 posts or more, so I have to point you to the post in a round-about manner.

There is no www in the link below.
The script is at allenbrowne dot com/ser-59alt.html

mandark1967
12-08-2008, 11:42 AM
I put it in a txt file and zipped it up.

It grabs everything I need, but I need this information in a table, not a worksheet, due to the sheer amount of filenames involved...