Help on file copy please

M

Mark

Using Access 2002 I want to programatically copy all jpg
files, whose name starts with the same 4 digit code, from
a temp folder into a subfolder whose name is the same as
that 4 digit.

I would appreciate some guidance on how to do this

Thanks in advance
 
K

Ken Snell [MVP]

This should get you started:

Dim strFile As String
Const str4DigitCode As String = "4444"
strFile = Dir("C:\MyFolder\" & str4DigitCode & _
"*.jpg")
Do While strFile <> ""
FileCopy "C:\MyFolder\" & strFile, _
"C:\MyNewFolder\" & Left(strFile, 4) _
& "\" & strFile
strFile = Dir()
Loop
 
Top