DIRECTORY BYTES

HELLO

How to find how many bytes are there

in a directory?

I DON't want to use list() ,to find each file in directory

and using lengh() in for loop and then adding

all.

Problem is: I want to find how many files are there

in all directory whose size is ,say greater than

1000 bytes.

So before searching for for a directory,

I want to know size of directory before

so that I can decide weather to search

that directoryor not.

Thanks

Pathreading

[545 byte] By [pathreading] at [2007-9-26 1:42:40]
# 1
That's easy, because all directories have size zero. So there aren't any directories with size > 1000 bytes.
DrClap at 2007-6-29 2:35:49 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...
# 2
HI,Thanks for reply,That means "Search has to be performed on each and every file from start to end in directory"Pathreading
pathreading at 2007-6-29 2:35:49 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...
# 3
I want to search the files whosesize is greater than 1000 bytes.Is it possible to avoid linear search? and usesome other logic?
pathreading at 2007-6-29 2:35:49 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...
# 4

I use a recursive method to parse the complete file srtructure under a 'target' directory.

This may be long depending on the number of files, but this the only way I found...

What I did is to store the method into a Thread, and call notify() when a new directory is processed. This way, another component (let'say a 'properties' dialog) may update its internal values each time the notify is catched.

I use this logic eitherto get the file size and file number

Maybe native method will be more accurate.

Also, have a look at the new IOAPI of jdk1.4...

vincent

dupontv at 2007-6-29 2:35:49 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...