?
Solved

Establish the folder size

Posted on 2006-06-07
28
Medium Priority
?
440 Views
Last Modified: 2013-12-18
Is there any possibility to find out how big each several folder is?

e.g. Inbox, Sent Items or other user created folder
0
Comment
Question by:verto33
  • 12
  • 8
  • 7
  • +1
28 Comments
 
LVL 22

Expert Comment

by:mbonaci
ID: 16850916
Hi verto33,
the first that comes to mind is to go through the view/folder doc by doc and summarize the sizes:

The size of a document in bytes:
    size = notesDocument.Size

Hope this helps,
Marko
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16850924
verto33,
this is quicker solution from Qualitee:

http://www.experts-exchange.com/Applications/Email/Lotus_Notes_Domino/Q_21269312.html

Hope this helps,
Marko
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16851291
A folder has no size...
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:verto33
ID: 16851647
All folders have the doc size column present, and that it is totaled.
I changed the Inbox and then selected "Action Upgrade Folder design"
I created an Agent and pasted the Script.

Error message: Variant doesn't contain an object.

Agent Trigger = on event, Action menu selection
Target = All document in the database

The code is under Initialize in the Agent.

0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16851668
verto33,
I'm just finishing the code for you, wait a few minutes.

Marko
0
 
LVL 22

Accepted Solution

by:
mbonaci earned 160 total points
ID: 16852080
verto33,
here you are:

Function getDbFolderSize( db As NotesDatabase, folderName As String ) As Double
%REM Mb¤, 07.06.2006.    
    'The function returns the sum of all doc sizes in the "folderName" folder (or view)
    'To get the sum of all doc's sizes of all db's folders pass empty string as the folderName

    'Requirements:
        'all folders have to have the column that lists the doc's size
        'that column:
            'has to have name (title) - "Size" (not case sesitive)
            'has to be totaled

    'recommended @Formula for the Size column:
    @If( @IsDocTruncated;
        @If( @TextToNumber( @Version ) < 172;
            @DocLength;
            @DocOmittedLength + @DocLength );
        @DocLength )
%END REM
    On Error Goto Errhandler
    Dim nav As NotesViewNavigator
    Dim row As NotesViewEntry
    Dim pos As Integer
   
    If folderName = "" Then    'Get all folder's size
        Forall folder In db.Views
            If folder.IsFolder Then
               
                'To get the index of Size column
                pos = -1
                Forall col In folder.Columns                    
                    If Lcase( col.Title ) = "size" Then
                        pos = col.Position - 1
                        Exit Forall
                    End If
                End Forall
               
                Set nav = folder.CreateViewNav
                Set row = nav.GetLast
               
                'Check if there are docs in the folder and that has the column named "Size"
                If Not row Is Nothing And pos <> -1 Then
                    getDbFolderSize = getDbFolderSize + row.ColumnValues( pos )
                End If
               
            End If
        End Forall
    Else
        Dim fldr As NotesView
        Set fldr = db.GetView( folderName )
        pos = -1
       
        'To get the index of Size column
        Forall column In fldr.Columns
            If Lcase( column.Title ) = "size" Then
                pos = column.Position - 1
                Exit Forall
            End If
        End Forall
       
        Set nav = fldr.CreateViewNav
        Set row = nav.GetLast                    
       
        If Not row Is Nothing And pos <> -1 Then
            getDbFolderSize = row.ColumnValues( pos )
        End If
       
    End If
   
leave:
    Exit Function    
Errhandler:
    Dim errMsg As String    
    errMsg = "Error in function - getDbFolderSize" & Chr$(10) & "Line: " & Cstr( Erl ) & Chr$(10) & "Err No: " & Err & ": " & Error$
    'Msgbox errMsg
    Print errMsg
    Resume leave
End Function


You call it like this (for Inbox folder), let's say from an action button:

Sub Click(Source As Button)
    Dim s As New NotesSession
   
    Msgbox |Inbox folder's size:

| & Cstr( Round( getDbFolderSize( s.CurrentDatabase, "($Inbox)" ) / 1024, 2 ) ) & " Kb"
   
End Sub

Keep in mind that the function @DocLength returns the approximate size of a document.

Marko
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16852213
Could you tell me why you need to know the "size" of a folder? Removing documents from a folder won't reduce the size of a database, since a folder doesn't "contain" documents: it contains references to documents.
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16858364
Another thought -- not sure if this is what you were looking for..

Open Administrator
Select the Server
Click on the Files tab
Select the Database
On the Tools Bar (right) expand Database
Select Manage Views

List of all views and their sizes appears for selected database.

You can purge the view index.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16859414
Just to be clear, this tool marilyng is talking about lists the size of view's index, not size of it's documents.

Marko
0
 

Author Comment

by:verto33
ID: 16859553
I pasted the above code. (Created an agent)

I created a button and pasted the code for it,too. I get an error message in the line:

| & Cstr( Round( getDbFolderSize( s.CurrentDatabase, "($Inbox)" ) / 1024, 2 ) ) & " Kb"

The error message is following:

Illegal parenthesized reference: GETDBFOLDERSIZE
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16859573
verto33,
on the form where the button is:
go to Globals - Declarations and paste the function getDbSize there.

The function will be placed after Terminate form event.

Then preview the form and click on the button.

Hope this helps,
Marko
0
 

Author Comment

by:verto33
ID: 16859579
I know the messagebox expression this way:  e.g.

Messagebox "Here my text.", 64, "Warning!"

What does the pipe mean in your line?
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16859589
verto33,
forget that, that's ok - the pipe is same as quotation mark but you can go to new line (use enter) when using pipe and then you'll get multiline messagebox.


Marko
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16859595
verto33,
the error message says that it can't find your function (that's because you put it in an agent).
Functions are placed at Global if you want to call them from any form design element's code (like your button).


Hope this helps,
Marko
0
 

Author Comment

by:verto33
ID: 16860335
I pasted the code at Global (on the Memo form) no error

Created the button on the Memo form and called it from there. I got the same error in the same line.
Illegal parenthesized reference: GETDBFOLDERSIZE

I know that isn't nice to place it on the Memo form but I don't know where I could place it.
0
 

Author Comment

by:verto33
ID: 16869788
I found below solution but when I paste "Option Public" I get the error message:

"Public is not allowed in this modul"

This is what I found:

"Illegal parenthesized reference with the name of the script library is displayed."  
 
Solution
In at least one case, this issue occurred when the "Option Public" line was inadvertently deleted from the Script library options section. Without that line, the script library could not be read by another LotusScript element.
To correct the issue, add Option Public back into the LotusScript Script Library options
 
0
 

Author Comment

by:verto33
ID: 16869917
I did following:

im Designer-Client: Tools -> Recompile All LotusScript

but the error is still  there.
0
 

Author Comment

by:verto33
ID: 16869974
I found this as well, but didn't help

The function that you are calling is not within the scope of the calling
function or event. If the user defined function is part of a script library
(ex: script library1), then in the form globals, "options", write the statement:
use "script library1".
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16871510
> I found below solution...
What solution?

When compiling, it also gave you the module or element with the error. It is either in that element, or in the libraries the element uses.

Did you place the code in the (Global) section or in the Form section?

I think you can better place the function in a separate script library, then "Use scriptlibraryname" in the code.
0
 

Author Comment

by:verto33
ID: 16885431
Sorry, I didn't paste it in the Global. It's my fault.

Now it works.

I will list all the folder size in one message box. I get a two lines message box when I paste the code from mbonaci.
But if I paste 2 or 3 lines additionally I get an error. "Unexpected: String Constant; Expected Statement"
I want to learn how to create a multiline message box.
Please have a look at the code below, are the pipes in the wrong places?

Msgbox |Inbox folder's size:

| & Cstr( Round( getDbFolderSize( s.CurrentDatabase, "($Inbox)" ) / 1024, 2 ) ) & " Kb"
      | & Cstr( Round( getDbFolderSize( s.CurrentDatabase, "Finance" ) / 1024, 2 ) ) & " Kb"      
      | & Cstr( Round( getDbFolderSize( s.CurrentDatabase, "SLeaders" ) / 1024, 2 ) ) & " Kb"

0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16885700
There's a begin-pipe and an end-pipe, but the pipes can be replaced by { and } ; these characters are easier to be recognised as string delimiters.
0
 

Author Comment

by:verto33
ID: 16892566
When I use a start and an end pipe then the code itself between the pipes will be displayed and not the executed code.
When I put the end pipe at the beginning of the last line then the last line's code is executed but the 2 lines above it is displayed as normal text and code isn't executed.

I can have the program to execute the code and display it in two lines but the moment I make three lines I always get an error message.

The messagebox can display normal text in several lines but not execute codes in several lines.

How many pipes should I write and where should I place them if I want a messagebox with three lines?

I don't understand with the  { and } ;
 Should I put { and } ; at the end of all lines?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16892718
The following are equivalent:
    "this is a string"
    |this is a string|
    {this is a string}

The same goes for the following equivalent strings spanning more than one line:
    "this is a very" & _
    " long string"
    |this is a very
 long string|
    {this is a very
 long string}

I could be mistaken about the newline inside the string, but that can easily be solved.  
0
 

Author Comment

by:verto33
ID: 16892818
Yes, I can display text in multiple lines within a message box with your examples above.
That's all right.

The problem is that if I place not text but codes inside the pipe or brackets, the code will be displayed as normal text.

This is a two liner and works OK. (displays the code's result and not normal text)

Msgbox |Inbox folder's size:

| & Cstr( Round( getDbFolderSize( s.CurrentDatabase, "($Inbox)" ) / 1024, 2 ) ) & " Kb"

How to make a three liner of it? Displaying the e.g. Inbox's size two times in different lines?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16892881
Each string should be enclosed in a pair of "" or || or {}

Msgbox |Inbox folder's size:

| & Cstr( Round( getDbFolderSize( s.CurrentDatabase, "($Inbox)" ) / 1024, 2 ) ) & " Kb" _
     & Cstr( Round( getDbFolderSize( s.CurrentDatabase, "Finance" ) / 1024, 2 ) ) & " Kb" _
     & Cstr( Round( getDbFolderSize( s.CurrentDatabase, "SLeaders" ) / 1024, 2 ) ) & " Kb"

or

Msgbox |Inbox folder's size:

| & Cstr( Round( getDbFolderSize( s.CurrentDatabase, "($Inbox)" ) / 1024, 2 ) ) & " Kb" & |
     | & Cstr( Round( getDbFolderSize( s.CurrentDatabase, "Finance" ) / 1024, 2 ) ) & " Kb" & |    
     | & Cstr( Round( getDbFolderSize( s.CurrentDatabase, "SLeaders" ) / 1024, 2 ) ) & " Kb"

0
 

Author Comment

by:verto33
ID: 16893108
Thanks,

I'm using the second variation now. It executes the code and displays in different lines.
I didn't succeed before because I didn't put the ampersand sign at the end before the pipe.

The first variation executes and displays the code in a right way but in 1 line. The three sizes are in 1 line.

But I'm glad to have a messagebox with multilines. I wouldn't have imagined that it takes so long to create a multiline box.
0
 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 120 total points
ID: 16893276
Dim CR As String

CR= Chr$(13)
Msgbox "Inbox folder's size:" & CR & _
    Cstr( Round( getDbFolderSize( s.CurrentDatabase, "($Inbox)" ) / 1024, 2 ) ) & " Kb" & CR & _
    Cstr( Round( getDbFolderSize( s.CurrentDatabase, "Finance" ) / 1024, 2 ) ) & " Kb" & CR & _
    Cstr( Round( getDbFolderSize( s.CurrentDatabase, "SLeaders" ) / 1024, 2 ) ) & " Kb"
0
 

Author Comment

by:verto33
ID: 16893335
Perfect
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question