4DOS Help Topic: Date Ranges
Date ranges select files that were created or last modified at any time
between the two dates. For example, /[d12-1-99,12-5-99] selects files that
were last modified between December 1, 1999, and December 5, 1999.
You can use hyphens, slashes, or periods to separate the month, day, and
year. 4DOS generally accepts dates between January 1, 1980 and December 31,
2099. The year can be entered as a 2-digit or 4-digit value. Two-digit
years between 80 and 99 are interpreted as 1980 - 1999; values between 00
and 79 are interpreted as 2000 - 2079. References to years beyond 2079 must
be entered with 4 digits. For example, /[d12-31-99,1-1-00] is equivalent to
/[d12-31-1999,1-1-2000], and selects files modified on December 31, 1999 or
January 1, 2000.
If an argument begins with a four digit year greater than 1900, it's assumed
to be a date in the ISO 8601 international format (yyyy-mm-dd). If the date
contains the letter "W", it is assumed to be in the ISO 8601 week date
format yyyy-Www-d, where yyyy = year, ww = week, d = week day. If the date
is entered as two numbers in the format yyyy-ddd, it is assumed to be in the
ISO 8601 ordinal date format, where yyyy = year, ddd = day of the year.
The time for the starting date defaults to 00:00:00 and the time for the
ending date defaults to 23:59:59. You can alter these defaults, if you
wish, by including a start and stop time inside the date range. The time is
separated from the date with an at sign [@]. For example, the range
/[d7-1-00@8:00a,7-3-00@6:00p] selects files that were modified at any time
between 8:00 am on July 1, 2000 and 6:00 pm on July 3, 2000. If you prefer,
you can specify the times in 24-hour format (e.g., @18:00 for the end time
in the previous example).
If you omit the second argument in a date range, 4DOS substitutes the
current date and time. For example, /[d10-1-99] selects files dated between
October 1, 1999 and today.
You can use an offset value for either the beginning or ending date, or
both. An offset begins with a plus sign [+] or a minus sign [-] followed by
an integer. If you use an offset for the second value, it is calculated
relative to the first. If you use an offset for the first (or only) value,
the current date is used as the basis for calculation. For example:
Specification Selects Files
/[d10-27-99,+3] modified between 10-27-99 and 10-30-99
/[d10-27-99,-3] modified between 10-24-99 and 10-27-99
/[d-0] modified today (from today minus zero days, to
/[d-1] modified yesterday or today (from today minus one
day, to today)
/[d-1,+0] modified yesterday (from today minus one day, to
zero days after that)
As a shorthand way of specifying files modified today, you can also use
/[d]; this has the same effect as the /[d-0] example shown above.
To select files last modified n days ago or earlier, use /[dn,1/1/80]. For
example, to get a directory of all files last modified 3 days or more before
today (i.e., those files not modified within the last 3 days), you could use
c:\> dir /[d-3,1/1/80]
This reversed date range (with the later date given first) will be handled
correctly by 4DOS. It takes advantage of the facts that an offset in the
start date is relative to today, and that the base or "zero" point for PC
file dates is January 1, 1980.
Note: If you do not specify a time in a reversed date range, the default
times will be applied before the first and second dates are swapped to
become the ending and starting dates respectively. If you want to include
the entire first and last days of a reversed date range, simply add a
specific @00:00:00 to your intended start date and a @23:59:59 to your
intended end date.
You cannot use offsets in the time portion of a date range (the part after
an @ sign), but you can combine a time with a date offset. For example,
/[d12-8-99@12:00,+2@12:00] selects files that were last modified between
noon on December 8 and noon on December 10, 1999. Similarly,
/[d-2@15:00,+1] selects files last modified between 3:00 pm the day before
yesterday and the end of the day one day after that, i.e., yesterday. The
second time defaults to the end of the day because no time is given.
The standard FAT file system maintains a single date for each file,
reflecting the last time the file was written. This is the date used by
4DOS on a FAT drive with no LFN support (e.g. under MS-DOS 6.22, PC DOS 7.0
or 2000, DR-DOS 7.03 without LONGNAME loaded, or OS/2).
Drives which support long filenames (e.g. under Windows 95/98/ME, or under
plain DOS with a suitable LFN driver loaded) maintain 3 sets of dates and
times for each file: creation, last access, and last write (for last access
only the date is recorded; the last access time is always returned as
00:00). By default, date ranges work with the last write time stamp. You
can use the "last access" (a) or "created" (c) date/time stamp in a date
range with the syntax:
/[da...] or /[dc...]
For example, to select files that were last accessed yesterday or today: