Combining files

H

Harmony

Hello,

I need to combine multiple dat files into one text file.
These dat files are all named the same for example :
01162004.dat but are in 23 different subfolders. How do I
search through these subfolders for this specific file
name and combine it into one text file?

Any help would be great!!

Thanks,

Harmony
 
J

Joe Fallon

Create an import routine and load all the data into Access.
Then export to a single file.

The routine can loop through a list of Paths (that you store in a table).
This way if you add more folders you just add the paths to the table and run
the import again.
 
H

Harmony

How would I do that?

Thanks,

Harmony
-----Original Message-----
Create an import routine and load all the data into Access.
Then export to a single file.

The routine can loop through a list of Paths (that you store in a table).
This way if you add more folders you just add the paths to the table and run
the import again.
--
Joe Fallon
Access MVP






.
 
J

Joe Fallon

Something along these lines:

How to Import all Files in a Folder:

Private Sub btnImportAllFiles_Click()
'procedure to import all files in a directory and delete them.
'assumes they are all the correct format for an ASCII delimited import.
Dim strfile As String

ChDir ("c:\MyFiles")
strfile = Dir("FileName*.*")
Do While Len(strfile) > 0
DoCmd.TransferText acImportDelim, "ImportSpecName", "AccessTableName",
"c:\MyFiles\" & strfile, True
'delete the file (consider moving it to an Archive folder instead.)
Kill "c:\MyFiles\" & strfile
strfile = Dir
Loop

End Sub
 

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