Page 1 of 1 1
Topic Options
#58984 - 2001-09-11 02:06 PM DIRUSE command in several folders
Anonymous
Unregistered


Hi

I have to make list about how much user has used space in common "\\server\user" directory.

Every user have unique private directory structure, like
\\server\user\user1\
\\server\user\user2\
\\server\user\user3\ and etc.

Result would be like:
user1 used space: 386116234 bytes
user2 used space: 331232141 bytes
user1 used space: 4523512 bytes

Would some specialist help me modify below scipt, in current version I must specify what dir im calculating:
******
break on cls
$tempfile = "c:\temp\kix.tmp"
$dir = "c:\"
if exist("$dir") = 1
? "Reading $dir...... Please wait."
shell '%comspec% /c diruse "$dir" | find /i " total" > $tempfile'
$nul = open(1,$tempfile,2)
$data = readline(1)
$dirsize = ltrim(substr($data,1,13))
? 'The size of "$dir" = $dirsize bytes'
else
? "can't find $dir"
exit
endif
******

Thank you for your help
Henry

Top
#58985 - 2001-09-11 04:30 PM Re: DIRUSE command in several folders
mvdw Offline
Starting to like KiXtart

Registered: 2001-05-01
Posts: 124
Loc: Voorburg, Netherlands
Hi Henry, welcome to the board.

i am not sure exactly what you mean, but if we take a look at the possibilties of diruse :

code:
 
C:\WINNT>diruse

DIRUSE displays a list of disk usage for a directory tree(s). Version 1.20

DIRUSE [/S | /V] [/M | /K | /B] [/C] [/,] [/Q:# [/L] [/A] [/D] [/O]] [/*] DIRS

/S Specifies whether subdirectories are included in the output.
/V Output progress reports while scanning subdirectories. Ignored if /S is
specified.
/M Displays disk usage in megabytes.
/K Displays disk usage in kilobytes.
/B Displays disk usage in bytes (default).
/C Use Compressed size instead of apparent size.
/, Use thousand separator when displaying sizes.
/L Output overflows to logfile .\DIRUSE.LOG.
/* Uses the top-level directories residing in the specified DIRS
/Q:# Mark directories that exceed the specified size (#) with a "!".
(If /M or /K is not specified, then bytes is assumed.)
/A Specifies that an alert is generated if specified sizes are exceeded.
(The Alerter service must be running.)
/D Displays only directories that exceed specified sizes.
/O Specifies that subdirectories are not checked for specified size
overflow.
DIRS Specifies a list of the paths to check.

Note: Parameters can be typed in any order. And the '-' symbol can be
used in place of the '/' symbol.

Also, if /Q is specified, then return code is ONE if any directories are
found that
exceed the specified sizes. Otherwise the return code is ZERO.

Example: diruse /s /m /q:1.5 /l /* c:\users


That means that you could issue the command with the correct params, and get a report in which you will find nice subtotals. the trick is /* i think.

i just tested on our userdir and it seemed to work just fine. all you need to do is fetch all the lines with "SUB-TOTAL" in them and grab the dirname and size from them.

with the /q option you could even set a limit, giving it a report with all dirs exceeding this limit.

dunno if it helped, if you need a sample script,pls tell me.

regards,
MvdW

_________________________
rgrds, Maarten

Top
#58986 - 2001-09-12 08:41 AM Re: DIRUSE command in several folders
Anonymous
Unregistered


Hi mvdw

Your tip was perfect. DIRUSE works fine for that purpose.

Thanks

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1607 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.052 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org