Reviewed and revised December 2023
tab(-10, AG_FILESTATS); fspec {,versiz, hashsiz, flags}; chr(127); Tab(-10,x) Syntax Notes
AG_FILESTATS (31) allows you to retrieve info about a file.
This function has both a subroutine and a print tab implementation.
Parameters
versiz, hashsiz
these are numeric values representing the size of the strings you intend to retrieve them into. If 0 or not specified, then the corresponding field will not be returned. Set versiz=30 to get the #####.#####.#####.#####.##### format; see MX_FILESTATS.
flags
may contain one or more of the following:
Value |
Description |
---|---|
&h0001 |
Check for fspec in ATE cache directories if not found otherwise |
&h0002 |
Returned client native spec of located file |
&h0004 |
Request return of last access time |
Response
The return string is of the format: bytes, mtime, ctime, mode {,ver, hash, pcspec, atime} CR
Example
.AGCMD AG_FILESTATS,"%ATE%\dsk0\007006\csv2xl.sbx",16,30,7
Response is: 122656,1696396569,1455643406,33206,2.2.0.291,376-212-504-153,,1701566017
This example illustrates the AGCMD utility which allows you to send AG_xxx functions (by name, internally using the TAB(-10,...) syntax shown at the top of this topic) and see the response, without writing any code. The downside is that the response (in this case) is somewhat hard to read due to the large encoded values for the mtime, ctime, mode and atime fields, but it does make clear exactly what response the program will see.
Comments
MX_FILESTATS is generally used in preference to AG_FILESTATS, because it is easier to use (standard subroutine return values), and works in all the same cases (including ATE), with the one exception that it requires A-Shell on the server. AG_FILESTATS could be used on any kind of server.
The pcspec is only returned in the case where the fspec is not fully qualified and the flags &h0002 bit is set causing the routine to locate the file in one of the cache directories.
Note that all fields are comma delimited up to the last non-blank field.
See Also
History
2023 August, A-Shell 6.5.1740: Add atime parameter, last access time
2011 June, A-Shell 5.1.1222: Add flags parameter, reformat return string