Directory listing

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

Hello,

Could someone please tell me how I can create a complete Directory
listing including size information and write this information to a table so
it can be used and manipulated?

Thank you,

Daniel
 
You can use Dir() function, see online help for info how to use it
to get a file size you can use FileSize function
 
Alex,

I'm having a hard time creating a loop function that will run over each sub
directory and then again in the sub sub dir and then the sub sub sub dir ...

Could you help,

Thanks,

Daniel
 
Here it is:

Dim strFile As String

strFile = Dir("C:\")
Do While Len(strFile) > 0
Debug.Print strFile
strFile = Dir
Loop


if you want to save it to table - you can use INSERT SQL instead of
Debug.Print

HTH
 
Alex:
I've been looking at other posts to see how to run the SQL code (INSERT
INTO) to populate my new table, but I'm just not getting it.

Thanks for the help, I've seen your name on a lot of useful posts.
Zadok
 
I've been looking at other posts to see how to run the SQL code (INSERT
INTO) to populate my new table, but I'm just not getting it.

strSQL = "INSERT INTO MyTable (FieldOne, FieldTwo) " & _
"VALUES (37, ""Eric"");"

db.Execute strSQL, dbFailOnError

If you have different values to poke in, you need to insert them in the
proper format:

strSQL = "INSERT INTO MyTable (NumFld, DateFld, TextFld) " & _
"VALUES (" & d& _
wMyNumber & _
", " & _
Format(dtMyDate, "\#yyyy\-mm\-dd\#") & _
", " & _
Chr$(34) & Replace(strMyText,chr$(34), string$(34,2)) & chr$(34) & _
")"

' always do this when you are creating even mildly complex SQL
' code...
MsgBox strSQL

' okay, make it so
db.Execute strSQL, dbFailOnError


Post back if you need more details.
Hope that helps


Tim F
 
Back
Top