www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Good way to get a file's datestamp?

reply AEon <aeon2001 lycos.de> writes:
What would be a good way to get the time/date of a file and use it in D?

I have found several command in std.date, and but none of them seems to 
operat on a file (std.file not help either)?

And would that code then be workable under Linux as well?
Mar 25 2005
parent reply Derek Parnell <derek psych.ward> writes:
On Sat, 26 Mar 2005 01:05:34 +0100, AEon wrote:

 What would be a good way to get the time/date of a file and use it in D?
 
 I have found several command in std.date, and but none of them seems to 
 operat on a file (std.file not help either)?
 
 And would that code then be workable under Linux as well?

In the Build utility's download, there is a module called util\fdt.d. This implements a FileDateTime class for both Windows and Unix. Not everything that could be there is included, but it served my purposes well enough. You could use it as a basis for something better. -- Derek Parnell Melbourne, Australia 26/03/2005 4:29:17 PM
Mar 25 2005
parent reply AEon <aeon2001 lycos.de> writes:
Derek Parnell wrote:
 On Sat, 26 Mar 2005 01:05:34 +0100, AEon wrote:
 
 
What would be a good way to get the time/date of a file and use it in D?

I have found several command in std.date, and but none of them seems to 
operat on a file (std.file not help either)?

And would that code then be workable under Linux as well?

In the Build utility's download, there is a module called util\fdt.d. This implements a FileDateTime class for both Windows and Unix. Not everything that could be there is included, but it served my purposes well enough. You could use it as a basis for something better.

At first I though this should be part of dm.zip and dtm.zip, but it is not. Can't seem to find it on http://www.digitalmars.com/ or via search: http://prowiki.org/wiki4d/wiki.cgi?Search A more specific link would be appreciated. Thanx. AEon
Mar 27 2005
next sibling parent Derek Parnell <derek psych.ward> writes:
On Sun, 27 Mar 2005 23:13:24 +0200, AEon wrote:

 Derek Parnell wrote:
 On Sat, 26 Mar 2005 01:05:34 +0100, AEon wrote:
 
 
What would be a good way to get the time/date of a file and use it in D?

I have found several command in std.date, and but none of them seems to 
operat on a file (std.file not help either)?

And would that code then be workable under Linux as well?

In the Build utility's download, there is a module called util\fdt.d. This implements a FileDateTime class for both Windows and Unix. Not everything that could be there is included, but it served my purposes well enough. You could use it as a basis for something better.

At first I though this should be part of dm.zip and dtm.zip, but it is not. Can't seem to find it on http://www.digitalmars.com/ or via search: http://prowiki.org/wiki4d/wiki.cgi?Search A more specific link would be appreciated. Thanx.

Ummmm... Build is a program that I wrote. It is not a DigitalMars product. http://www.dsource.org/projects/build -- Derek Parnell Melbourne, Australia 28/03/2005 7:25:55 AM
Mar 27 2005
prev sibling parent J C Calvarese <jcc7 cox.net> writes:
AEon wrote:
 Derek Parnell wrote:
 
 On Sat, 26 Mar 2005 01:05:34 +0100, AEon wrote:


 What would be a good way to get the time/date of a file and use it in D?

 I have found several command in std.date, and but none of them seems 
 to operat on a file (std.file not help either)?

 And would that code then be workable under Linux as well?

In the Build utility's download, there is a module called util\fdt.d. This implements a FileDateTime class for both Windows and Unix. Not everything that could be there is included, but it served my purposes well enough. You could use it as a basis for something better.

At first I though this should be part of dm.zip and dtm.zip, but it is not. Can't seem to find it on http://www.digitalmars.com/ or via search: http://prowiki.org/wiki4d/wiki.cgi?Search

I searched for "build" at Wiki4D, it gave me links to several pages. Yes, most are probably false positives. At least one of them is appropriate: http://www.prowiki.org/wiki4d/wiki.cgi?ReferenceForTools (i.e., http://www.prowiki.org/wiki4d/wiki.cgi?ReferenceForTools#Build) When I searched for "build tool", I got much better results (only one false positive). Build is an apt name, but it's not the easiest to search for. (Just as D is a worthy name for the D programming language, but googling requires creativity.) It's a new tool and there's been quite a bit of buzz about it, so I'm sure Derek just assumed that you had heard of it already. -- jcc7 http://jcc_7.tripod.com/d/
Mar 27 2005