Re: Directory info?
- Posted by DonCCole Sep 20, 2008
- 1192 views
Don,
There's a demo with Win32Lib called "WalkDir", which might be overkill for what you want, but it should be adaptable to output file/directory sizes for summing; right now it just shows all dirs/files, but you could certainly tweak it for file sizes. I think I did something like that to show all dirs ranked by size on a drive, but I'm not sure where it is right now.
DanM
Thanks Dan for that idea.
In DOS or Command prompt if I type 'dir' I get:
08/30/2008 09:53 PM <DIR> .
08/30/2008 09:53 PM <DIR> ..
08/30/2008 09:53 PM <DIR> Start Menu
08/30/2008 09:54 PM <DIR> My Documents
08/30/2008 09:54 PM <DIR> Favorites
08/30/2008 09:23 PM <DIR> Desktop
08/31/2008 09:53 PM 877 AutoHotkey.ini
09/19/2008 09:40 PM 2,097,152 ntuser.dat
2 File(s) 2,098,029 bytes used space
6 Dir(s) 1,305,751,552 bytes free free space
In windows if I click on my Computer and then right click a drive I get:
A pie chart that shows,
used space
free space
capacity
In euphoria dos,
d = dir(current_dir())
d might have:
{ {".", "d", 0 1994, 1, 18, 9, 30, 02},
{"..", "d", 0 1994, 1, 18, 9, 20, 14},
{"fred", "ra", 2350, 1994, 1, 22, 17, 22, 40},
{"sub", "d" , 0, 1993, 9, 20, 8, 50, 12}
}
d[3][D_NAME] would be "fred" name
d[3][D_S1ZE] would be "fred" size
this gives me total size of all the files, but not free space or used space
Let us just forget about sub directory right now as I have that covered with walk_dir.
What I want to find in a used space, free space and capacity.
Of course *capacity* = free space + used space.
I need two of these factors to figure the third.
How can I do this with euphoria?