This function returns the list of the files at the source store.
object.GetFiles(aPath)
Part | Attribute | Type | Description |
---|---|---|---|
object |
Required | The object always implements the
ISSourceStore interface |
|
aPath |
In, Required | string |
The full path of the file location
folder |
Create new folders with the specified paths and display some information about the folder tree, including the list of the files contained.
sub main
Dim aStore
Dim aMessage
set aStore = Profile.SourceStore
EnsureFolder aStore, "Examples"
EnsureFolder aStore, "Examples/Part1"
EnsureFolder aStore, "Examples/Part2"
aMessage = GetSubfoldersInfo(aStore, "", 0)
Profile.MsgBox(aMessage)
end sub
function GetSubfoldersInfo(aStore, aPath, aLevel)
Dim aFolders, aFolder
Dim aFiles, aFile
Dim i, j
Dim aInfo
set aFolders = aStore.GetFolders(aPath)
for i = 0 to aFolders.Count - 1
set aFolder = aFolders.GetItem(i)
set aFiles = aStore.GetFiles(aFolder.FullPath)
aInfo = aInfo & vbNewLine & Space(aLevel * 4) & aFolder.FullPath &_
" (Files: " & aFiles.Count & ")"
for j = 0 to aFiles.Count - 1
set aFile = aFiles.GetItem(j)
aInfo = aInfo & vbNewLine & Space(aLevel * 4) & (j + 1) & ") " &_
aFile.FileName
next 'j
aInfo = aInfo & GetSubfoldersInfo(aStore, aFolder.FullPath, aLevel + 1)
next 'i
GetSubfoldersInfo = aInfo
end function
sub EnsureFolder(aStore, aFolderName)
Dim aFolder
on error resume next
set aFolder = aStore.GetFolder(aFolderName)
if Err.Number <> 0 Then
Err.Clear
set aFolder = aStore.CreateFolder(aFolderName)
Profile.MsgBox("The folder '" & aFolder.FullPath & "' was created")
end if
end sub