Arbortext Command Language > Functions by Alphabetical Listing > file_size
  
file_size
file_size (path)
 
This function returns the size in bytes of the file specified by path. The path argument is either a file system path or an HTTP or HTTPS resource. For the latter, the function issues an HTTP HEAD request and uses the response header called Content-Length to determine the modification time. On any error, or if the desired response header is missing, this returns -1.
The file_size function can be written using file identifier functions as follows:
function file_size(path)
{
local fid = open(path, "rb")
if (fid < 0) {
return -1
}
seek(fid, 0, 2); # to eof
local off = tell(fid)
close(fid)
return off
}