Home | Gallery | Forum | Services | Webmail | Archive | Links | Contact Us | About Us
OS2 World.Com Forum
OS2 World.Com Online Discussion Forum.
Index / OS/2 - General / Programming
author message
How to use REXX program to check directory size ?
Post a new topic Reply to this Topic Printable Version of this Topic Forward this Topic to your Friend Topic Commands (for administrator or moderators only)
Sam
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 70
since: 05 Feb, 2004
1. How to use REXX program to check directory size ?
Reply to this topic with quote Modify your message
I would like to write REXX progrm to check for size of particular directories.

Is there any utilies / command that can fullfill this requirement ?

Thanks in advance.

Date: 19 Oct, 2006 on 19:47
mobybrick
Normal member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 38
since: 23 Jul, 2004
2. Re:How to use REXX program to check directory size ?
Reply to this topic with quote Modify your message
Hi,

There are probably better ways of doing it, but I knocked this up for you. Include the two functions Digit: and Get_DirSize in you code, and then you can call Get_DirSize to get the directory size of the specified directory. If you need to calculate the size of the tree, then you will need to modify the code to do /S.

There is probably a REXX DLL to do this somewhere, but this will work for the moment...

Yours,
Moby.

/* OS/2 REXX */

/*Test*

say 'Size of C:\ is 'Get_DirSize("C:\")
signal end


Get_DirSize: Procedure
myline=''
DirSize = "ERROR"
do while queued() <> 0; parse pull; end;
cmd="@dir "arg(1)". 2>nul | rxqueue 2>NUL 1>&2"
cmd
do while queued() <> 0
myLine = lineIN( "QUEUE:" )
if abbrev( reverse( myLine ), reverse( "bytes used" ) ) then
DirSize = word( myLine, 3 )
end

DirSize=translate(DirSize)
i=length(DirSize)
tempstr=DirSize
j=0
multi=0
tempchar=''
DirSize=''
do while j \= i
j=j+1
tempchar=digit(tempstr,j)
if tempchar = 'K' then multi=1
if tempchar \= '' then if tempchar \= ' ' then if tempchar \= 'K' then if tempchar \= ',' then DirSize=DirSize''tempchar
end
if multi=1 then DirSize=DirSize*1024
RETURN DirSize


digit: Procedure
/* Returns specified digit in supplied string. Use is string, position - where position starts from 1 */
/* if arg(2) > length(arg1) then return '' */
leftstr=left(arg(1),arg(2))
return right(leftstr,1)


end:

Date: 20 Oct, 2006 on 01:27
melf
Premium member
in staff

View this member's profileSearch all posts from this memberSend an email to this member
posts: 212
since: 11 Apr, 2003
3. Re:How to use REXX program to check directory size ?
Reply to this topic with quote Modify your message
In eCS, at least from version 1.1 there is a function, if you rightclick on a folder, called "show tree size" (Folder actions>show tree size). You get info of folder size but also size of files, and some other info.

---
/Mikael
Date: 20 Oct, 2006 on 09:18
mobybrick
Normal member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 38
since: 23 Jul, 2004
4. Re:How to use REXX program to check directory size ?
Reply to this topic with quote Modify your message
I know, but I think Sam wanted a REXX program to do it...
Date: 20 Oct, 2006 on 15:08
melf
Premium member
in staff

View this member's profileSearch all posts from this memberSend an email to this member
posts: 212
since: 11 Apr, 2003
5. Re:How to use REXX program to check directory size ?
Reply to this topic with quote Modify your message
..suspected that..but just had to mention..

---
/Mikael
Date: 20 Oct, 2006 on 16:31
Sam
Premium member
in user

View this member's profileSearch all posts from this memberSend an email to this member
posts: 70
since: 05 Feb, 2004
6. Re:How to use REXX program to check directory size ?
Reply to this topic with quote Modify your message
Moby, Mikael,

Thanks for the help. I want to implement that in an legacy (Pre eCom) OS/2 system.

Date: 22 Oct, 2006 on 12:22
How to use REXX program to check directory size ?
Post a new topic Reply to this Topic Printable Version of this Topic Forward this Topic to your Friend Topic Commands (for administrator or moderators only)
All times are CET+1. < Prev. | P. 1 | Next >
Go to:
 

Powered by UltraBoard 2000 Standard Edition,
Copyright © UltraScripts.com, Inc. 1999-2000.
Home | Gallery | Forums | Services | Webmail | Archive | Links | Contact Us | About Us
© OS2 World.Com 2000-2004