Creating a database from the Windows directory

  • Thread starter Thread starter Kris Anderson
  • Start date Start date
K

Kris Anderson

Hello,

I'm new to this group. I've searched everywhere I know to,
to find a way to take the information from the Windows
directory and create a database from it. I'd like the DB
to show folders, subfolders and files, as well as create
dates, size, etc.

Is there a way to do this?

Thanks in advance for any and all help.

Kris
 
I am not sure whether you are using the term 'database' in
its correct sense. An Access database is a collection of
all kinds of 'objects' like tables, forms, queries,
macros, reports etc. So the answer to your question is -
no.

However, if what you meant is that you would like to have
a database, which has a table which stores the names of
paths, folders and filenames - then the answer is yes.

I have one in my database. My table has the fields :
RefID (autonumber, primary key)
PathName
FileName
DateCreated
Size

I have an auto-Form created from the 'File Library' table
and in the form header I have 2 text boxes - SearchFolder
and SearchExtension. I have a command button - 'Load Files'

and the following code in the command button's On Click
event procedure :

Private Sub cmdLoadOLE_Click()
Dim MyFolder As String
Dim MyExt As String
Dim MyPath As String
Dim MyFile As String
Dim strCriteria As String

MyFolder = Me!SearchFolder
' Get the search path.
MyPath = MyFolder & "\" & "*." & [SearchExtension]
' Get the first file in the path containing the file
extension.
MyFile = Dir(MyPath, vbNormal)
Do While Len(MyFile) <> 0
[OLEPathName] = MyFolder & "\"
[OLEFileName] = MyFile
[DateCreated] = FileDateTime(MyFolder & "\" & MyFile)
[Size] = FileLen(MyFolder & "\" & MyFile)
' Check for next OLE file in the folder.
MyFile = Dir
' Go to new record on form.
DoCmd.RunCommand acCmdRecordsGoToNew
Loop

End Sub

Maybe this is what you have in mind and that it will help.

I don't often come to this forum too often, so if you want
more info - you can email me.


Matthew
 
Back
Top