У меня есть агент для вывода и удаления файлов во временной папке Domino:
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Print "-- running from db " + db.Notesurl
Set filelist = New HandleFilesInDirectory("D:\IBM\Domino\Temp\notes53F5BD\xspupload\")
'Set filelist = New HandleFilesInDirectory("D:\IBM\Domino\Temp\notes53F5BD\")
Call filelist.GetFilesOnDisk()
'%REM
Print "Directory List Starts"
ForAll x In filelist.m_SumDirs
Print ListTag(x)
End ForAll
'%END REM
'%REM
Print "File List Starts"
ForAll y In filelist.m_SumFiles
Print ListTag(y)
Kill y
End ForAll
'%END REM
Call filelist.EraseListFromMemory()
End Sub
Scriptlibrary:
%REM
Class HandleFilesInDirectory
Description: Comments for Class
%END REM
Public Class HandleFilesInDirectory
Private m_session As NotesSession
Private m_DirectoryStart As String
Public m_SumDirs List As String
Public m_SumFiles List As String
Public Sub New (DirectoryStart As String)
Set me.m_session = New NotesSession
me.m_DirectoryStart = DirectoryStart
End Sub
%REM
Sub GetFilesOnDisk
Description: Comments for Sub
%END REM
Public Sub GetFilesOnDisk()
Call me.ScanDirs(me.m_DirectoryStart)
End Sub
%REM
Sub ScanDirs
Description: Comments for Sub
%END REM
Private Sub ScanDirs(path As String)
Dim sess As New NotesSession
Dim DirList As Variant
Dim filename As String
Dim filepath As String
Dim sep As String
If path <> "" Then
If InStr(sess.Platform, "Windows") > 0 Then
sep = "\"
Else
sep = "/"
End If
ReDim DirList(0)
If InStr(path, sep) > 0 Then
filepath = StrLeftBack(path, sep)
End If
filename = Dir(path, 16)
While filename <> ""
If filename <> "." And filename <> ".." Then
If (GetFileAttr(filepath & sep & filename) And 16) >0 Then
DirList = ArrayAppend(DirList,filepath & sep & filename & sep)
m_SumDirs(filepath & sep & filename & sep) = "Yes"
Else
' PERFORM DESIRED CHECK/OPERATION
' ON filepath & sep & filename
' OR filename (as desired)
m_SumFiles(filepath & sep & filename) = "Yes"
End If
End If
filename = Dir
Wend
DirList = FullTrim(DirList)
ForAll dirpath In DirList
ScanDirs(dirpath)
End ForAll
End If
End Sub
%REM
Sub EraseListFromMemory
Description: Comments for Sub
%END REM
Public Sub EraseListFromMemory()
Erase m_SumDirs
Erase m_SumFiles
End Sub
End Class
, который возвращает следующий вывод:
[02D4: 0002-0C68] 2019-09-24 16:19:19 AMgr: Печать агента ('GetMyFiles' в 'KKom \ patrick \ app.nsf'): D: \ IBM \ Domino \ Temp \ notes53F5BD \ xspupload \placeholder.txt [02D4: 0002-0C68] 2019-09-24 16:19:19 AMgr: Сообщение об ошибке агента ('GetMyFiles' в 'KKom \ patrick \ app.nsf'): Ошибка доступа к пути / файлу
Агент подписан надлежащим ID, а уровень безопасности во время выполнения установлен на 3
Может кто-нибудь объяснить, что я делаю неправильно?