PDA

View Full Version : Does anyone know what I am doing wrong?



Scampula
12-04-2003, 04:57 PM
Here is the deal.

I am trying to find the size of a directory on a drive.

I am using the following command.


Fsize = File.GetSize ("GoFile");
Tsize= Tsize+Fsize

The above is in a loop that is working due to it is adding the names (GoFiles) to a listbox .

After the loop is..
Tsize= Math.Floor(Tsize/1048576);


I know the system gives my bytes so I am deviding by 1,048,576

That should give me Megs.

On a directory that has a stated size of 481 Megs I am getting a size of 53247.

The raw Tsize I am getting is 55834574835 instead of the windows size of 505,270,272


Can anyone knock me in the head with what I am doing wrong here..

Lorne
12-04-2003, 09:57 PM
Sounds like the problem lies in how you're collecting/adding the file sizes. Could be that you're counting the same files more than once.

What does the rest of the code look like?

Scampula
12-05-2003, 04:12 AM
I used the code posted by worm in another post and now all is okay. Thanks for the come back lorne .

Thanks for the DLL worm!

Later