我用到一个组件:commerce.AdminFiles,它是Microsoft site server, commerce edition中附带的,可以单独使用.以下方法是我在程序中用的直接搬过来给你.如果组件找不到的话给我来信我给你一个.
方法如下:
'
' Get files in given folder
'
Public Function getFiles(ByVal strPathName As String, ByRef files)
' declare Cadminfiles obj variable
Dim inFiles
' set error handle
On Error Resume Next
Err.Clear
' Create new CAdminfiles object
Set oAdminFile = CreateObject("commerce.AdminFiles.1")
If Err.Number <> 0 Then
getFiles = False
Exit Function
End If
' Get the files in given folder
If right(strPathName, 1) <> "\" Then
strPathName = strPathName & "\"
End If
strPathName = strPathName & "*.*"
Err.Clear
inFiles = oAdminFile.getFiles(strPathName)
If Err.Number <> 0 Then
getFiles = False
Exit Function
End If
files = inFiles
getFiles = True
' Release the object
Set oAdminFile = Nothing
End Function