#170296 - 2006-11-15 12:10 PM
GetDiskSpace function not working properly ?
|
rheffels
Lurker
Registered: 2006-02-22
Posts: 4
|
How come that the following script is reporting the same size for dir1 as dir2 ? Am I missing something here ? Both dirs exist though...
SIZE.KIX Open( 1 , "size.csv" , 5 ) WriteLine( 1 , "dir1;" + GetDiskSpace("F:\DIR1") + ";" + @CRLF ) WriteLine( 1 , "dir2;" + GetDiskSpace("F:\DIR2") + ";" + @CRLF ) Close ( 1 )
SIZE.CSV dir1;43303784; dir2;43303784;
|
Top
|
|
|
|
#170297 - 2006-11-15 01:54 PM
Re: GetDiskSpace function not working properly ?
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Hi rheffels, Welcome to the korg, I believe what is going on, is that ‘GetDiskSpace(< drive letter >:)’ is not designed to look at directories, it only looks at drives and because both dir's you have there are both on drive F.
You could try fnGetFolderProp(). I think it will get you what you are looking for.
|
Top
|
|
|
|
#170298 - 2006-11-15 02:07 PM
Re: GetDiskSpace function not working properly ?
|
rheffels
Lurker
Registered: 2006-02-22
Posts: 4
|
That's what I thought, but that's not what it says in the command reference http://www.kixtart.org/index.asp?p=commandRef#_Toc146265755
"On Windows NT and on Windows 95 OSR2 and later versions, Drive does not have to specify the root directory on a disk. On these platforms, the function accepts any directory on a disk."
And it doesn't work on Windows XP Professional and Windows 2003 Server. So... Is it a bug or something ? :-)
|
Top
|
|
|
|
#170300 - 2006-11-15 03:49 PM
Re: GetDiskSpace function not working properly ?
|
Chris S.
MM club member
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Here is the direct link to fnGetFolderProp().
|
Top
|
|
|
|
#170302 - 2006-11-16 05:53 PM
Re: GetDiskSpace function not working properly ?
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
|
Here's a simple script to get disk space and size. Written this in 2 mins, a personal record Code:
Function DiskSpace Dim $WshShell, $fso, $Drive, $DriveCol, $drv $WshShell = CreateObject("WScript.Shell") $fso = CreateObject("Scripting.FileSystemObject") $DriveCol = $fso.Drives For Each $Drive in $DriveCol If $Drive.DriveType = 2 $drv = $fso.GetDrive($Drive) ? "Free Space of " + $Drive " = " + $drv.FreeSpace / 1024 / 1024 / 1024 + " GB" ? "Total Space of " + $Drive " = " + $drv.TotalSize / 1024 / 1024 / 1024 + " GB" EndIf Next EndFunction
|
Top
|
|
|
|
#170304 - 2006-11-17 07:51 AM
Re: GetDiskSpace function not working properly ?
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
The GAVEN principal
|
Top
|
|
|
|
#170305 - 2006-11-19 02:35 PM
Re: GetDiskSpace function not working properly ?
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
|
LOL nice one
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 557 anonymous users online.
|
|
|