Technical References - [listfiles]

When listing files, WebDNA provides a number of tags to display file info

numero = 108
interpreted = N
texte = [listfiles FolderPath]File Tags[/listfiles]
Parameters used in the context
path (required) The path to the folder which is to be listed. This path is relative to the template.
ShowInvisibles(optional) Macintosh only: if set to T, then display invisible filenames, if set to F, do not display invisible filenames
Name (optional) filters files by name
Exact(optional, used with Name) if set to T, then display filenames that match 'Name' criteria exactly; if set to F, partial match is enough
Tags available inside the ListFiles context
[isfolder]"T" if this item is a folder. "F" otherwise.
[isfile]"T" if this item is a file. "F" otherwise.
[filename] Name of the file.
[fullpath] Full path to the file, starting from its containing FolderPath.
[moddate]Last date the file was modified.
[modtime]Last time the file was modified.
[createdate]Date the file was created.
[createtime]Time the file was created.
[size]The file's size, in bytes.
[index]The file's position in the list
[startpath]The folder path leading to the file.
[break]From version 8.1, if the [listfiles] context sees the [break] tag while executing a loop, it will stop looping, once it finishes the current loop. Thus the [break] tag should only appear in a [showif] statement that is evaluated at the end (bottom) of the loop.

There is no facility for sorting the file list within the [listfiles] context. This is determined by the server. One way to sort is to capture the results in a [table] context, then search and sort the table as desired.

You can use the 'Name' and 'Exact' parameters with the [listfiles] context to 'filter' the results. For example: If the current folder contains the files: file1.txt file2.txt file2.txt
[listfiles path=../&name=file1&exact=f][filename][/listfiles]
Results will be: file1.txt Directory file listing, with files and only files, showing only .png and .swf files and no file extension?:
[listfiles path=./][showif [isfile]=T][if ("[filename]" ^ ".png")|("[filename]" ^ ".swf")][then][grep search=\..*&replace=][filename][/grep]
[/then] [else][/else] [/if][/showif][/listfiles]
If the current folder contains the files: file1.txt file2.png file3.txt file4.swf file5.jpg Results will be: file2 file4 (See "WebDNA vs. PHP") [listfiles FolderPath]File Tags[/listfiles]

Parameters used in the context
path (required) The path to the folder which is to be listed. This path is relative to the template.
ShowInvisibles(optional) Macintosh only: if set to T, then display invisible filenames, if set to F, do not display invisible filenames
Name (optional) filters files by name
Exact(optional, used with Name) if set to T, then display filenames that match 'Name' criteria exactly; if set to F, partial match is enough


Tags available inside the ListFiles context
[isfolder]"T" if this item is a folder. "F" otherwise.
[isfile]"T" if this item is a file. "F" otherwise.
[filename] Name of the file.
[fullpath] Full path to the file, starting from its containing FolderPath.
[moddate]Last date the file was modified.
[modtime]Last time the file was modified.
[createdate]Date the file was created.
[createtime]Time the file was created.
[size]The file's size, in bytes.
[index]The file's position in the list
[startpath]The folder path leading to the file.
[break]From version 8.1, if the [listfiles] context sees the [break] tag while executing a loop, it will stop looping, once it finishes the current loop. Thus the [break] tag should only appear in a [showif] statement that is evaluated at the end (bottom) of the loop.


There is no facility for sorting the file list within the [listfiles] context. This is determined by the server. One way to sort is to capture the results in a [table] context, then search and sort the table as desired.


You can use the 'Name' and 'Exact' parameters with the [listfiles] context to 'filter' the results.

For example:

If the current folder contains the files:

file1.txt
file2.txt
file2.txt

[listfiles path=../&name=file1&exact=f]
[filename]
[/listfiles]

Results will be:

file1.txt

Directory file listing, with files and only files, showing only .png and .swf files and no file extension?:
[listfiles path=./]
[showif [isfile]=T]
[if ("[filename]" ^ ".png")|("[filename]" ^ ".swf")]
[then]
[grep search=\..*&replace=][filename][/grep]

[/then]
[else][/else]
[/if][/showif][/listfiles]

If the current folder contains the files:

file1.txt
file2.png
file3.txt
file4.swf
file5.jpg

Results will be:

file2
file4

(See "WebDNA vs. PHP") Terry Wilson

DOWNLOAD WEBDNA NOW!

Top Articles:

WebDNA reference

...

Download WebDNA Applications

WebDNA applications...

Tips and Tricks

A list of user-submitted tips ...

WebDNA Modules

A list of the currently available modules...

AWS Raw WebDNA LAMP-Plus WebServer

Amazon Web Services (AWS) README for Machine Image ID...

Technical Change History

This Technical Change History provides a reverse chronological list of WebDNA changes...

Related Readings:

[loop]

Loops through the enclosing text the specified number of times...

[showif]

[showif Comparison]Show This HTML[/showif]...

[table]

[table] allows you to quickly create a temporary 'in line' database that is local to the template and not part of the global database cache...

[encrypt]

[encrypt] and [decrypt] allow you to store sensitive data in your databases without risk of exposing it to prying eyes...

[!]

Hides text...

[writefile]

[writefile] functions allows you to perform a wide variety of tasks...