To find the size of the directory

Hello,
I want to perform some activities based on the directories. I request U to help me to achieve the following.
(i) find the size of a particular directory.
(ii) to enumerate all the file in a particular directory in the order of time stamp.

Comments

  • [b][red]This message was edited by chick80 at 2003-1-27 13:24:56[/red][/b][hr]
    : Hello,
    : I want to perform some activities based on the directories. I request U to help me to achieve the following.
    : (i) find the size of a particular directory.
    : (ii) to enumerate all the file in a particular directory in the order of time stamp.
    :
    :
    To find the size of a directory just sum the size of the file contained in it (there's no other way as far as I know).
    To enumerate the file use FindFirstFile/FindNextFile/FindClose APIs to retrieve the files in a particular directory; to find the file size use GetFileSize and to find the time stamp use GetFileTime.
    To order by time stamp just use CompareFileTime.

    Note that the handle needed by GetFileSize/GetFileTime is NOT the handle you retrieve with FindFirstFile, but is an handle you get using CreateFile (opening the file either with GENERIC_READ or GENERIC_WRITE access).

    nICO

    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS




  • : [b][red]This message was edited by chick80 at 2003-1-27 13:24:56[/red][/b][hr]
    : : Hello,
    : : I want to perform some activities based on the directories. I request U to help me to achieve the following.
    : : (i) find the size of a particular directory.
    : : (ii) to enumerate all the file in a particular directory in the order of time stamp.
    : :
    : :
    : To find the size of a directory just sum the size of the file contained in it (there's no other way as far as I know).
    : To enumerate the file use FindFirstFile/FindNextFile/FindClose APIs to retrieve the files in a particular directory; to find the file size use GetFileSize and to find the time stamp use GetFileTime.
    : To order by time stamp just use CompareFileTime.
    :
    : Note that the handle needed by GetFileSize/GetFileTime is NOT the handle you retrieve with FindFirstFile, but is an handle you get using CreateFile (opening the file either with GENERIC_READ or GENERIC_WRITE access).
    :
    : nICO
    :
    : [hr]
    : [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    : JOHN KEATS
    :
    :
    :
    :
    :
    [blue]Why slow down the code?!.. [b]WIN32_FIND_DATA[/b] has all that information (dates, size, etc.) without any [b]CreateFile()[/b].[/blue]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories