| This does it for the current account; it's easily extendable to loop through
all accounts.
! Script to calculate (an over-estimate of) the size of all document's in the
! drawers of a user's file cabinet that are owned by the user running the
! script. Note the size doesn't include FILECAB.DAT, DOCDB.DAT, DAF.DAT, etc.
get #total = 0
decimal I
get #owner = '[' OA$USER ']'
for filecab with .unique_name = #owner do -
cabinet set_drawer .unique_name \\ -
.text "" \\ -
.text 'Drawer: "' .unique_name '"' \\ -
for cab$ do -
get #size = file$.allocation[.filename] \\\\ -
compute #total = #total + #size \\\\ -
.text ,4, 'Document: "' .%key '"' \\\\ -
.text ,8, .filename:30 #size \\\\ -
cabinet current .%key \\\\ -
for cab$attach do -
get #size = file$.allocation[.filename] \\\\\\\\ -
compute #total = #total + #size \\\\\\\\ -
.text ,8, .filename:30 #size
.text "Total size of all files is " #total " blocks"
|
| Re .-1
That's ok for V3.0 but the base note says V2.4...;^)
Re .0
What's wrong with the CDQ housekeeping procedure? That loops through all
accounts and puts the results into a log file in OA$LOG, and into the
profile...
You could:-
1) Use CDQ
2) Use the code from the CDQ procedure
3) Do something like the following:-
.label start
for cab$ do oa$null\\get #count = oa$sel_count
get oa$display = "You have " #count " documents"
this could be expanded to do the same for all users by doing something
like...
.label start
get #me = oa$user
text_file open/write out "count.log"
for profil with .direct nes "" do get #user = .user\\do count
text_file close out
get oa$func = 'newdir ' #me
display Finished
.exit
COUNT.SCP
---------
.label start
get oa$func = 'newdir ' #user
.if oa$status ne 1 then .goto error
get oa$display = 'Processing user ' #user\force
get #count = 0
for cab$ do oa$null\\get #count = oa$sel_count
get #text = #user:30 " has " #count " documents."
text_file write out #text
.exit
.label error
get #text = "**** Unable to process user " #user " ****"
text_file write out #text
.exit
These either need to be in OA$LIB or referenced explicitly (ie do
user:[bloggs.a1]count)
Cheers,
Andy
P.S. - I just typed these in so they may not work first time, but you should
be able to get the general idea... ;^)
|