how to write du (disk usage) command

can anyone supply me with some source code about how to write ‘du’?
i need to ge the size of each file in a directory, and sum them up, and
if there are sub-directory, i ned to do it recursively… it seems
difficult,
can someone help??

My goal is to get the size of a directory, so I can update my RtProgress
during a ‘copy’ command…

“ran zhang” <rzhang@vamcointernational.com> wrote in message
news:9pa3co$1pq$3@inn.qnx.com

can anyone supply me with some source code about how to write ‘du’?
i need to ge the size of each file in a directory, and sum them up, and
if there are sub-directory, i ned to do it recursively… it seems
difficult,
can someone help??

My goal is to get the size of a directory, so I can update my RtProgress
during a ‘copy’ command…

PLEASE do not cross post.

ran zhang <rzhang@vamcointernational.com> wrote:

can anyone supply me with some source code about how to write ‘du’?
i need to ge the size of each file in a directory, and sum them up, and
if there are sub-directory, i ned to do it recursively… it seems
difficult,
can someone help??

My goal is to get the size of a directory, so I can update my RtProgress
during a ‘copy’ command…

Look at the C functions opendir, readdir, closedir (dirent.h),
the Watcom C Library Reference contains some example programs.


Mgr. Martin Gazak, MicroStep-MIS
Ilkovicova 3, 841 04 Bratislava, Slovakia
Tel: +421 2 60291 816
e-mail:matog@microstep-mis.sk