Page 1 of 1 1
Topic Options
#119188 - 2004-05-07 01:37 PM network drive
wilcobruxz Offline
Lurker

Registered: 2004-05-07
Posts: 2
Hello,

I am making a kix login script, and when users logon the get a P-drive to a user directory on the server (\\server\username$) At the end of the login script there is a messagebox with the username and some other things displayed. Can i show the size of the users P-drive on this messagebox??

Top
#119189 - 2004-05-07 02:02 PM Re: network drive
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
You can use:

Code:

SHELL "%COMSPEC% /e:1024 /c DIR P:\*.* /s"




Quote:


Total Files Listed:
21175 File(s) 3,827,601,140 bytes




Edited by Co (2004-05-07 02:05 PM)
_________________________
Co


Top
#119190 - 2004-05-07 02:07 PM Re: network drive
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Not easily.

If you have quotas enabled you may be able to use WMI to query it, otherwise you will need to iterate the files and directories and create a total yourself.

You could scan the entire disk on a regular basis (hourly?) on the server, and create a disk usage map that you can get the info from. Something like Treesize may do this for you.

Top
#119191 - 2004-05-07 02:10 PM Re: network drive
wilcobruxz Offline
Lurker

Registered: 2004-05-07
Posts: 2
Quote:

You can use:

Code:

SHELL "%COMSPEC% /e:1024 /c DIR P:\*.* /s"



Quote:


Total Files Listed:
21175 File(s) 3,827,601,140 bytes







Ik heb deze code toegevoegs aan mijn login script alleen hoe kan ik de uitkomst van de code weergegeven laten worden in mijn messagebox??

Top
#119192 - 2004-05-07 02:13 PM Re: network drive
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Quote:

Ik heb deze code toegevoegs aan mijn login script alleen hoe kan ik de uitkomst van de code weergegeven laten worden in mijn messagebox??




Wilco,

This is an international board. If we do this conversation in Dutch, Most of the other members can't help you because they can't read Dutch...

It doesn't matter if your English isn't perfect. My English isn't But being a member of this board makes me a better scripter and I learn a bit English too !!
_________________________
Co


Top
#119193 - 2004-05-07 02:19 PM Re: network drive
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

You can use:

Code:
--------------------------------------------------------------------------------

SHELL "%COMSPEC% /e:1024 /c DIR P:\*.* /s"





This is a good quick'n'dirty solution, but it has a couple of drawbacks:
  • Depending on the number of files and directories, this can take a while to compute
  • It won't include the size of the directories themselves (at least I don't think it will - someone correct me if I'm wrong)
  • It only counts the size of the data in the file, not the amount of disk used.


That last one may warrant some explanation.
When you create a file with (say) one character in it, the file length is "1".

The actual amount of disk used to store the file however is the size of the basic filesystem block - it used to be 4Kb. This means that your 1 byte file actually uses 4Kb of disk to store it.

These odd fragments of blocks are not particularly interesting for single files, but when you start getting very large numbers of small files the "wasted" space becomes very large.

A good example is temporary Internet files, which by their nature tend to be small and numerous. Here, the discrepancy between the total file size and actual disk space consumed can become significant.

[EDIT]
One notable exception...
Compressed volumes may store the data in a different format, which is slower to access but is far more efficient in terms of disk space usage
[/EDIT]


Edited by Richard H. (2004-05-07 02:28 PM)

Top
#119194 - 2004-05-07 02:23 PM Re: network drive
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Use:

Code:
SHELL "%COMSPEC% /e:1024 /c DIR P:\*.* /s >%windir%\temp\dir.txt"  




The output is saved to file: C:\windows\temp\dir.txt

You have to read the last line:

21175 File(s) 3,827,601,140 bytes

and put it in the messagebox...


_________________________
Co


Top
#119195 - 2004-05-07 02:27 PM Re: network drive
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
Richard,

I agree. But if you don't use quotas I don't know an other way to get it...
_________________________
Co


Top
#119196 - 2004-05-07 02:38 PM Re: network drive
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
How about using fnGetFolderProp()...

Code:

FormatNumber(fnGetFolderProp(@HomeDrive,Size),0)


Top
#119197 - 2004-05-07 03:03 PM Re: network drive
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

How about using fnGetFolderProp()...

Code:

FormatNumber(fnGetFolderProp(@HomeDrive,Size),0)






Close. The size is still the file size in bytes, not disk used.

If you can get the "Size on disk" value that you see when you look at the properties of the file/folder it would be more accurate.

Top
#119198 - 2004-05-07 07:44 PM Re: network drive
Co Offline
MM club member
***

Registered: 2000-11-20
Posts: 1342
Loc: NL
The properties of a networkdrive gives you the disksize and used space of the drive/partition which contains this mapped folder...

Edited by Co (2004-05-07 07:45 PM)
_________________________
Co


Top
Page 1 of 1 1


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

Who's Online
0 registered and 874 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.033 seconds in which 0.014 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