Get file name and put into a file.

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

Hi folks,

Does anyone know the way to get all the files name (or
specific file type) within a folder and put them in to
access table through a model?

I have a folder called Temp that has the following file:

a.txt
123.doc
b.exe

I want import the files name only to a table.

FileName
A
123
b

Any help will be appreciated.

Thanks.

Tim.
 
The Dir function will return all files within a folder. Something like the
following:

Dim strFolder As String
Dim strFile As String

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

Is that enough to get you going?
 
Doug,

Thanks for your help.

Tim.
-----Original Message-----
The Dir function will return all files within a folder. Something like the
following:

Dim strFolder As String
Dim strFile As String

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

Is that enough to get you going?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)





.
 
Doug,

Thanks for your help.

Tim.
-----Original Message-----
The Dir function will return all files within a folder. Something like the
following:

Dim strFolder As String
Dim strFile As String

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

Is that enough to get you going?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)





.
 
Back
Top