Import of File and Folder Names

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

Having about a million of clipart on various CD's and in several folders
from many different suppliers, who all have none to very poor information
about its content, I would like to fill a table with file names and their
path. As I do add / delete quite often files, I have to do this over and over
again. In addition, i intend to have another table, referring to the file
name and stating information to the files content in my own way and
systematic.

Is there any way to read in a complete structure of Folders, Subfolders and
their Files by using vb.

My idea is, to name the main path first (e. g.
E:\Archive\ClipArt\Food\Dishes). Then my existing table is deleted, a new one
created, and then filled with each file name and path. So far there is no
problem for me, but to determine the folders and subfolders and subsubfolders
etc. etc. names, as beforehand I do not know, how many subs will exist.

Probably its just a loop routine, but I cannot find a simple and easy
solution.

Maybe someone will know.

Hopefully

Ulrich1947
 
One simple approach is to use the Shell command to run a simple Dir /s/b
statement and pipe the results into a text file which you can then read.

Alternatively, you can use the FIndFirstFile, FindNextFile and FindClose
APIs. Randy Birch has a good example of this at
http://vbnet.mvps.org/code/fileapi/recursesaveadv.htm

Obligatory warning: Randy's site is aimed at VB programmers. Due to
significant differences between controls available for forms in VB and in
Access, many of his samples can't simply be copied into Access. Looking at
this particular one, the code related to populating the comboboxes will not
work in any version of Access prior to Access 2003. However, if you can
understand what the code's getting from the comboboxes, you'll see that
that's not particularly important in getting the list of files.
 
Sorry to bother again. The Randy Birch solution seems a bit too complicated
to me at present, I would try that second (especially as I do work with
Access 2000).

But can you help me with a sample of the Shell command or a reference to
solution which uses such command ?

Thanks in advance

Ulrich1947
 
Back
Top