GSAK (Geocaching Swiss Army Knife)
Contents - Index

Dir (function)

Dir(sPath,sOptions) : string

The Dir() function allows you to retrieve a directory listing of files The return string is a semi colon delimited list of "FileName;FileSize;Date;Time". You can also add the path to this list by using the "P" option.

sPath - The directory (using wild cards) to list
sOptions -
H - Add a header as the very first line (especially useful when using this list in SQL)
P - Add the file path to the list
S - Include sub directories in the list
F - Return the "FileName" only

Here is an example of how to use this function to display a directory (and sub folders) in your browser:

$data = dir("c:\temp\demo\*.*","HSP")
$result = sqltohtml($data,"Directory list","y")

This produced the following list:

Alpha List         Category List

Copyright 2004-2016 CWE Computer Services  
Privacy Policy Contact