Board index » delphi » Getting current directory's attributes (BP7)

Getting current directory's attributes (BP7)

Hi,

This may be in a FAQ - or even the manual(s) - but I haven't found it...

Can anyone tell me how to get and set the time/date attributes of the current
DIRECTORY when nothing else is known?

Any pointers (no pun intended) would be most welcome ;)

 

Re:Getting current directory's attributes (BP7)


There are several ways. Easiest is probably FindFirst(). And yes it's in
the manuals.

Cheers,
Anco.

Re:Getting current directory's attributes (BP7)


Quote
The Bishop wrote:
> Can anyone tell me how to get and set the time/date attributes of the current
> DIRECTORY when nothing else is known?

Can we assume that you at least know the name of the directory?

AME

Re:Getting current directory's attributes (BP7)


Quote
The Bishop (jes...@inq.fi) wrote:

:
: Hi,
:
: This may be in a FAQ - or even the manual(s) - but I haven't found it...
:
: Can anyone tell me how to get and set the time/date attributes of the current
: DIRECTORY when nothing else is known?
:
: Any pointers (no pun intended) would be most welcome ;)

  Getting the time/date is no problem, but setting it is not possible under
DOS. You should use the following code to determine the date of a directory:

var
  SR: SearchRec;
begin
  FindFirst(DirName, $7f, SR);
  if DosError = 0 then begin
    UnPackTime(SR.Time, ....);
  end;
end;

You'll find the exact parameters of UnPackTime in the help or in the manual.
The $7f parameter of findfirst is an attribute filter, and $7f simply means
that all files (regardless of its attribute) should be found...

--

                                Balazs Scheidler

*-------------------------------------------------------------------------*
| Author of Turbo Vision Resource WorkShop, the ultimate resource toolkit |
| for Turbo Vision for Pascal and C++. You can get the latest version at  |
| ftp://tolna.hungary.net/pub/tvrw/tvrw33d.zip                            |
| ftp://simtel.net/pub/simtelnet/msdos/turbovis/tvrw33d.zip               |
*--------------------------------------------*bAzSi*----------------------*

Re:Getting current directory's attributes (BP7)


Quote
In article <57jacf...@tron.sci.fi>, The Bishop <jes...@inq.fi> wrote:

:This may be in a FAQ - or even the manual(s) - but I haven't found it...

No, this one is not.

:Can anyone tell me how to get and set the time/date attributes of the current
:DIRECTORY when nothing else is known?

Setting a directory's date is one of those task that has been
discussed several times before without finding a solution. However,
there must be one, since such utilities exist without source code.
As for getting the attributes, that should not be any more difficult
than for any file. There the FAQ should be able to help.

   All the best, Timo

....................................................................
Prof. Timo Salmi   Co-moderator of news:comp.archives.msdos.announce
Moderating at ftp:// & http://garbo.uwasa.fi archives  193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:t...@uwasa.fi  <URL:http://uwasa.fi/~ts>  ; FIN-65101,  Finland

Other Threads