Delete all folders in mail file except the folder "MyFolder"

Hello,

I'm looking for a peace of lotus script which deletes all folders created by a user except for one with a specific name.

Hope you can help

Barend

Hi Barend,

Please create a new LotusScript agent with the following code.

If you face any problem. Please let us know.

LotusScript Code:

Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim views As Variant
Dim HCLSuppliedFolder As Boolean

Set db = session.CurrentDatabase
views = db.Views
ForAll v In views
If v.IsFolder Then
If InStr(v.Name, "$") = 0 And (v.Name<> "MyFolder") Then
HCLSuppliedFolder=False
Else

HCLSuppliedFolder=True
End If

If v.EntryCount = 0 And Not HCLSuppliedFolder Then 'Folder must be empty and not contain $ in name
MessageBox "Folder " & v.Name & " removed."
v.Remove
End If 'End of v.EntryCount...
End If 'End of v.IsFolder
End ForAll

Please refer the below technical document for more information.

URL : https://support.hcl-software.com/csm?id=kb_article&sysparm_article=KB0026707

Please let us know if you need more information.

Thank you,

Regards,

Sridhar

Thank you I will give it a try

I have done a test. You have to close the database and reopen it to see the results. Further I delete also the folder which contains messages. Those message are only visible in All document. Fine for me.

Thanks for you help. It's exactly what I needed!