Copyright 2008 Shoptalk Systems

FILES #handle, path$


Create a file accessor object for path$ and assigned to variable #handle.  The object provides a streaming interface to each next file or directory at that location.  The path can contain a wildcard for pattern matching specific files if needed.


  if Platform$ = "win32" then
    files #dir, "public\docs\*.html"
  else  'assume Mac OS or Linux
    files #dir, "public/docs/*.html"
  end if
  #dir dateformat("mmm dd, yyyy")
  while #dir hasAnswer()
    #dir nextFile$()
    print #dir name$(); "|";
    print #dir size(); "|";
    print #dir date$(); "|";
    print #dir time$()

File accessor methods:

#handle HASANSWER() - Return non-zero if the file accessor has at least one resulting row.
#handle ROWCOUNT() - Return the number of rows returned.
#handle NEXTFILE$() - Advance to the next row and return a comma delimited string for the next file (name, size, date, time, directory flag).
#handle NEXTFILE$([delimExpr$]) - Like NEXTFILE$() but you get to specify the delimiter instead of a comma.
#handle NAME$() - Return the name of the current file row.
#handle SIZE() - Return the size of the current file row.
#handle DATE$() - Return a string containing a formatted date for the current file row.
#handle TIME$() - Return a string containing a formatted time for the current file row.
#handle ISDIR() - Return non-zero if the current file row represents a directory instead of a file.
#handle RESET() - Reset the file accessor back to the beginning so you can read through them again.
#handle DATEFORMAT(template$) - Set the date format using a "mmm dd, yyyy" style template$.
#handle TIMEFORMAT(template$) - Set the time format using a "hh:mm:ss" style template$.
#handle ISNULL() - Returns zero (or false)
#handle DEBUG$() - Returns the string "Files"