🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17606

Re: How to get timestamp of a directory

#17606
From: Remy Lebeau (TeamB)
Date: Sun, 23 Mar 2003 21:25
49 lines
3099 bytes
"David Cameron" <dave@NO_SPAM.please.ecclehill.freeserve.co.uk> wrote in
message news:3e7e0c97@newsgroups.borland.com...

> For instance, if you try FindFirstFile with the name of
> a root directory of a drive as the path parameter, the
> fuction fails (i.e it returns INVALID_HANDLE_VALUE).
> I tried this with "C:\\" and "C:", both returned
> INVALID_HANDLE_VALUE.
> Do you know of a workaround for this Ed?

Under NT/2K/XP, at least, you should be able to use CreateFile() to open the
drive directly and then use GetFileTime() or GetFileInformationByHandle().
Under Win9x/Me, you can't open a rive directly, but instead query it
indirectly using VMM32.VXD.

> For example "My Documents" passed to FindFirstFile
> as the path name results in failure. As you probably know,
> if you create several "user profiles" under windows, then
> the "My Documents" folder can map to a different directory
> depending on the current user.
> If no user profiles are used the default "C:\\My Documents"
> works OK as it is a directory name as opposed to a folder
> name.

You can use SHGetSpecialFolderLocation() and SHGetPathFromIDList() to
resolve a "special" folder name into its physical user-specific location,
and then use FindFirstFile() with that path instead.

> Also, do you know if the "last modification time" of a directory
> (e.g WIN32_FIND_DATA::ftLastWriteTime) is updated in
> these circumstances:
>   1. A file in that directory is updated.
>   2. A new file is created in that directory.
>   3. A file is deleted from that directory.
>   4. A subdirectory is added to that directory.
>   5. A subdirectory is deleted from that directory.
>   6. A file is updated\created in a subdiretory of that directory etc.

According to MSDN:

    ftLastWriteTime
    A FILETIME structure. For a file, the structure specifies when the file
was last written to. For a directory, the structure specifies when the
directory was created. If the underlying file system does not support last
write time, this member is zero.


Gambit
Technical Details
Message-ID: <3e7e23e6$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <Xns9347BC315BB75dzeidzei@207.105.83.65> <3e7de3b8@newsgroups.borland.com> <3e7e0c97@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,ddd5fd2f8652aa3a
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-03-23 23:45:33 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <Xns9347BC315BB75dzeidzei@207.105.83.65> <3e7de3b8@newsgroups.borland.com> <3e7e0c97@newsgroups.borland.com>
Subject: Re: How to get timestamp of a directory
Date: Sun, 23 Mar 2003 13:25:03 -0800
Lines: 51
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3e7e23e6$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1048454118 207.175.226.26 (23 Mar 2003 13:15:18 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail