#135129 - 2005-03-09 09:17 AM
Math not working as expected
|
HeartCore
Fresh Scripter
Registered: 2005-03-01
Posts: 17
|
Something else came up 
Code:
$e = "%userprofile%\Mijn documenten" $mydocs = dirplus($e, "/s") for each $file in $mydocs $docfiles=$docfiles+$file.size next ? $docfiles + " used by My Documents
Now then, the code seems to work because I'm getting some numbers but they are wrong. When I do a dir /s in my documents, I get 147.411.122 bytes in 133 files. However, when I run the script I get 178.325.888 bytes (the loop runs 87 times which makes sense because when I subtract the number of folders that reside under my documents, I end up with that number).
Anyone has a clue why kix counts 170+ MB data and Windows only 140?
What I want to do with this script is to get an idea how much space is in use by our users profiles on the local harddisk so we can plan migrating this data to a fileserver.
Henk
|
|
Top
|
|
|
|
#135131 - 2005-03-09 10:42 AM
Re: Math not working as expected
|
HeartCore
Fresh Scripter
Registered: 2005-03-01
Posts: 17
|
Acutally both thing you mention seemd to apply:
Code:
$e = "%userprofile%\Mijn documenten" $mydocs = dirplus($e, "/s") for each $file in $mydocs if NOT GetFileAttr($file) = 16 ; not a directory $docfiles=$docfiles+GetFileSize($file) endif next ? $docfiles + " used by My Documents
Reports the correct size now.
Thanks Henk
|
|
Top
|
|
|
|
#135132 - 2005-03-09 03:03 PM
Re: Math not working as expected
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
If you just want the files, use the dirplu() /a-d option, it will only return the files.
Code:
$e = "%userprofile%\Mijn documenten" $mydocs = dirplus($e, "/s /a-d") for each $file in $mydocs $docfiles=$docfiles+GetFileSize($file) next ? $docfiles + " used by My Documents
|
|
Top
|
|
|
|
#135135 - 2005-03-09 05:00 PM
Re: Math not working as expected
|
HeartCore
Fresh Scripter
Registered: 2005-03-01
Posts: 17
|
Quote:
Although if you are using it for sizing, you probably want to include the directory sizes as these will consume disk at the new location too.
I'm not sure what's happening.... For example, there's 47 directories in my own 'my documents' folder. If I include the size of the dirs in my script, it tells me these 47 directories are about 30 megs together and that doesn't seem right to me.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 847 anonymous users online.
|
|
|