IBM®
Skip to main content
    Country/region select      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     

developerWorks  >  Lotus  >  Forums & community  >  Best Practice Makes Perfect

Best Practice Makes Perfect

A collaboration with Domino developers about how to do it and how to get it right in Domino

I while back I wrote a post containing code to clean up empty folders from user mail files. Yesterday, someone pointed out to me that it doesn't take into account the fact that folders that contain subfolders can be technically empty, in the sense of containing no documents, but we don't want to delete them if they have subfolders which are non-empty -- or if they have subfolders we don't also want to delete. So I came up with a new version of the code that deals with those situations.

As background, there actually is no such thing as a folder that contains another folder. Folders can contain documents. The apparent containment of folders in folders comes from the way the mail application's navigation pane organizes its outline. Folders whose names contain a backslash are displayed as subfolders in the outline, so for instance "Customers\Yoyodyne" appears in the UI as follows:

Image:Delete empty folders, take 2

It's not necessary for there to even be a folder named "Customers" for the subfolder to exist and be displayed in this way. From the end user's perspective, though, this is a detail we would like to hide. So the goal for this tool is to act as if folders contained other folders, even though this is not technically the case.

So the behavior reflected by the code attached below is:

  • We'll show the user a list of empty folders and let them select which ones to delete.
  • A folder is considered empty if it contains no documents and all its subfolders (if any) are also empty.
  • The list of empty folders will not include any subfolder if its parent is also listed. So in the above example, if Customers contains no documents and Customers\Yoyodyne is also empty, we would only list Customers as a candidate for deletion.
  • Selecting a parent folder for deletion also deletes its subfolders (same as if a folder is deleted from the mail navigator).

Andre Guirard | 10 April 2013 10:36:59 AM ET | | Comments (2)


 Comments

1) Another folder script idea
Mathieu Pape | 4/15/2013 8:16:25 AM

Thank you for this tip Andre !

An other folder related question we often see is how you can mass-rename folders. This happens because you don't get a warning when you use non-authorized chars in folder names (a backslash for example).

Also see :

{ Link }

{ Link }

2) Invalid characters in folder names
Andre Guirard | 4/15/2013 11:53:15 AM

There's an SPR, number AGUD8USQ68, about adding validation to the UI for creating folder names. It's currently marked as "no plan to fix" <b>because there are no customer reports</b>.

An explanation from someone in the field of how much trouble it is to recover from the end user entering an illegal name, might do much to raise the priority of this issue.

 Add a Comment
Subject:
   
Name:
Comment:  (No HTML - Links will be converted if prefixed http://)
 
Remember Me?     Cancel

Search this blog 

Disclaimer 

    About IBM Privacy Contact