Folder

V

Vina

is it possible to create something that it will look at a
certain folder and look for MDB's in that folder and then
to look on the details on that folder to when it was
modified and write all these in a table. It is possible
to be done in access.

Can someone give me an idea how to go about this.

Thanks
Vina
 
D

Dirk Goldgar

Vina said:
is it possible to create something that it will look at a
certain folder and look for MDB's in that folder and then
to look on the details on that folder to when it was
modified and write all these in a table. It is possible
to be done in access.

Can someone give me an idea how to go about this.

Thanks
Vina

Sure. Something like this "air code":

'----- start of code -----
Dim db As DAO.Database
Dim strFolder As String
Dim strFileName As String
Dim dtFileDate As String

strFolder = "C:\Temp\"

Set db = CurrentDb

strFileName = Dir(strFolder & "*.mdb")
Do Until Len(strFileName) = 0
db.Execute _
"INSERT INTO tblMDBList " & _
"(FileName, FileDate) " & _
"VALUES('" & _
strFileName & _
"', " & _
Format(FileDateTime(strFolder & strFileName), _
"\#mm/dd/yyyy hh:nn:ss AMPM\#") & _
")", _
dbFailOnError

strFileName = Dir()
Loop

Set db = Nothing
'----- end of code -----
 
J

John Nurick

Hi Vina,

I'd use the FileSystemObject object for this. This comes with Folder and
File objects which have useful properties like .DateLastModified and
..DateLastAccessed.
 
V

Vina

John,

Can you give me more information on how to use this?
-----Original Message-----
Hi Vina,

I'd use the FileSystemObject object for this. This comes with Folder and
File objects which have useful properties like .DateLastModified and
..DateLastAccessed.

is it possible to create something that it will look at a
certain folder and look for MDB's in that folder and then
to look on the details on that folder to when it was
modified and write all these in a table. It is possible
to be done in access.

Can someone give me an idea how to go about this.

Thanks
Vina

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
.
 
V

Vina

Dirk,

Thanks for this, it work really great but one more
question. How can i add to get the full path of the file.
I am planning to just search the whole C:\ drive so i
need to get the full path for the files found.

Really appreciate your help.
 
D

Dirk Goldgar

Vina said:
Dirk,

Thanks for this, it work really great but one more
question. How can i add to get the full path of the file.
I am planning to just search the whole C:\ drive so i
need to get the full path for the files found.

Really appreciate your help.

Change this:

to this:

"VALUES('" & _
strFolder & strFileName & _
"', " & _
 
V

Vina

Dirk,

Thanks once again but one more thing if you dont mind. I
have noticed that when i do the folder like "C:\" it will
only search the root, it's not searching the
subdirectories. do you think it would be easy to make it
that it will search the whole c:\ drive? any ideas?

Thanks
Vina
 
J

John Nurick

Vina,

Originally you said you wanted to look at "a certain folder". Now it
seems you want to recurse through all the folders on the disk.

The simplest way to do this IMO is

1) open a command prompt ("DOS prompt") and run a command like this to
create a textfile containing a list of all the .mdb files on the disk:

DIR *.MDB /S /B > "C:\Folder\Database List.Txt"

2) import this file into an Access table (I'll call it tblFiles). Allow
Access to create a primary key.

3) add a date/time field to the table. Let's call the field with the
filename and path FileSpec, and the date/time field DateLastModified.

4) Populate the DateLastModified field by using the FileDateTime()
function in an update query. The SQL view of the query will look like
this:
UPDATE tblFiles
SET DateLastModified = FileDateTime([FileSpec]);




John,

Can you give me more information on how to use this?
-----Original Message-----
Hi Vina,

I'd use the FileSystemObject object for this. This comes with Folder and
File objects which have useful properties like .DateLastModified and
..DateLastAccessed.

is it possible to create something that it will look at a
certain folder and look for MDB's in that folder and then
to look on the details on that folder to when it was
modified and write all these in a table. It is possible
to be done in access.

Can someone give me an idea how to go about this.

Thanks
Vina

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top