Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to do now or maybe a request for new functionality

May
855
0
First off, I will precede this by saying I, myself, don't greatly need this at the present moment; I have a mostly acceptable "alternative" that, unfortunately is only available to me (more on that at the bottom of this e-mail). But what I would like is a function (similar to the existing "@FileAge" function except that it would return the file's age in a human-readable format that the existing "@FileAge" function does not do; I’ve (at least “mostly”) “figured out" what a file’s ”age” “consists” of, but that’s not too useful) that returns a file's age in the general format "[yy years ][mm months ][dd days ][hh:mm:ss[.fff]]" such as "12 years 5 months 21 days 10 hours 21 minutes 30.123 seconds" where each of the "fields" is omitted if zero (i.e.," 5 months 3 hours", as a rather-unlikely example). There are many times where I really want to know how “old” a file is, and I do not, at least, know of any other way to do that.

Now, as I believe I’ve mentioned in the past, I’ve got a (C++) program I wrote many years ago named “DCalc” (for “Decimal Calculator”), but given the range of capabilities that that program now has, that name is really not all that “descriptive” any more. As just one example, the program will do date/time arithmetic with very few “limitations”, and the “output” of said program is generally acceptable in most situations, but not in all situations. For example, if I type in the “command” “HowOld ASampleFile.txt” a, I might get something back like “6 days, 16:30:59”. However, it would be nice if the report was in the format “6 days 16 hours 30 minutes and 59 seconds”, but, even more importantly, if I enter the command “HowOld ARatherOldFile.txt”, I “get back” something like “6979 days 13:02:04”, which is really only “partially” acceptable because “6979” days is not too meaningful to anybody.

So, just for the record, here is the “Alias” command I used to "create" the “HowOld” command:

Code:
Alias HowOld=`DCalc /B Now()-(%@Left[6,%@FileDate[%1,%1]]%@If[%@Right[2,%@File
Date[%1,%2]] LT 20,20,19]%@Right[2,%@FileDate[%1,%2]]+%@FileTime[%1,%2])
I’m not going to take the time to “parse” that in any great detail, but it really isn’t all that complicated.
 
How to do now or maybe a request for new functionality ("Suggestion")

From: mathewsdw

This is the concise summary of the post:
| a function that would return the file's age in a human-readable format
| such as "12 years 5 months 21 days 10 hours 21 minutes 30.123 seconds"
| where each of the "fields" is omitted if zero (i.e.," 5 months 3 hours").

You are actually asking for two separate features:
1/ a function that provides the AGE of a file, i.e., the time elapsed since the file was created, or since it was last modified, or since it was last accessed
2/ a function which reports a time interval in terms of years, months, days, hours, minutes and seconds.

The first is relatively simple: %@eval[%@fileage[XXXXX] - %@makeage[%_date,%_time]] is the current age of the file as a multiple of 100ns. The only problem is if you do this at almost midnight local time, and one of _date and _time is from before midnight, the other is at or after midnight.

The second part is not trivial at all if the interval is longer than 28 days. Do you want to define "year" and "month" relative to today? Do you want a generic length for month, e.g., 30 days? Do you want a generic length for year, e.g., 365.25 days? It is a lot simpler to do it in terms of days, or days and weeks, which have invariant lengths.
--
Steve
 
On Mon, 14 Nov 2011 22:01:39 -0500, Steve Fabian <> wrote:

|The first is relatively simple: %@eval[%@fileage[XXXXX] - %@makeage[%_date,%_time]] is the

I think you got 'em backwards.
 
How to do now or maybe a request for new functionality ("Suggestion")

From: vefatica
| Steve Fabian wrote:
|
|| The first is relatively simple: %@eval[%@fileage[XXXXX] -
|| %@makeage[%_date,%_time]] is the
|
| I think you got 'em backwards.

You are correct! I goofed!
--
Steve
 

Similar threads

Back
Top