Page 1 of 1 1
Topic Options
#170296 - 2006-11-15 12:10 PM GetDiskSpace function not working properly ?
rheffels Offline
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 Offline
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.
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#170298 - 2006-11-15 02:07 PM Re: GetDiskSpace function not working properly ?
rheffels Offline
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
#170299 - 2006-11-15 02:40 PM Re: GetDiskSpace function not working properly ?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
You mis-understand the comments in the manual.

Although you can supply any directory, it is still the drive space that is returned.

If you read through it again you will see that it never says that it returns directory space. It only refers to returning drive space.

Top
#170300 - 2006-11-15 03:49 PM Re: GetDiskSpace function not working properly ?
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Here is the direct link to fnGetFolderProp().
Top
#170301 - 2006-11-16 04:04 PM Re: GetDiskSpace function not working properly ?
rheffels Offline
Lurker

Registered: 2006-02-22
Posts: 4
Ah, thanks for the function, it works !
But the documentation of GetDiskSpace() is a bit odd...
Why would you want to specify a directory if you get the space available on the drive ?
You might as well specify the drive then...

Top
#170302 - 2006-11-16 05:53 PM Re: GetDiskSpace function not working properly ?
Arend_ Moderator Offline
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
#170303 - 2006-11-17 05:40 AM Re: GetDiskSpace function not working properly ?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
URL found in 10 seconds :-)

DiskSpace() - returns the available disk space on a drive
_________________________
There are two types of vessels, submarines and targets.

Top
#170304 - 2006-11-17 07:51 AM Re: GetDiskSpace function not working properly ?
NTDOC Administrator Offline
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_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
LOL nice one
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
0 registered and 557 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.073 seconds in which 0.036 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