CF_DirInfo Tag Documentation

Copyright © 1998 Roy P. Johnston, Jr. Written by Roy P. Johnston, Jr.

Document created October 14, 1998 - Updated Friday, February 28, 2003

The most current version of this document is available at: http://www.johnstons.org/wdc/pub/cfusion/customtags/CF_DirInfo.html


Contents


Description

This custom tag returns tree structure and information about a directory. The returned info includes: If the Recurse parameter is set to Yes, then all subdirectories will be included in the totals.

Syntax

<CF_DIRINFO BASEDIR="directory" RECURSE="[Yes | No]" DIRDELIMITER="[#CHR(13)# | ,]" TREELIST="[Yes | No]">

Attributes

AttributeTypeDescription
BASEDIR="directory" Required Specifies the directory that CF_DirInfo will return information about.
RECURSE="[Yes | No]" Optional Indicates whether CF_DirInfo should include subdirectories in the directory query. Yes is the default.
DIRDELIMITER="[#CHR(13)# | ,]" Optional The delimiter to be used in the DirInfo_List. Can be a comma or CHR(13). Comma (,) is the default.
TREELIST="[Yes | No]" Optional Indicates whether CF_DirInfo should return information in DirInfo_List and DirInfo_Tree. If Yes, DirInfo_List will return a delimited list of directories and subdirectories while DirInfo_Tree will return a textual model of the directory structure. If No, DirInfo_List will return root (\) and DirInfo_Tree will return the directory name only. No is the default.

Please Note: This option can be very time consuming.

Returned Values

VariableDescription
DirInfo_Size Specifies the total size of all files in the directory/subdirectories.
DirInfo_Count Specifies the total number of subdirectories in the directory/subdirectories.
DirInfo_Tree Textual model of the directory structure.
DirInfo_LevelCount Number of directory levels traversed. Equals 1 if recursion is turned off.
DirInfo_List Delimited list of directory/subdirectories. Comma (,) or EOL (CHR(13)) are valid Delimiters. Specifies each directory name as a relative path to the base directory.
DirInfo_FileCount Specifies the total number of files in the directory/subdirectories.
DirInfo_ErrorCode Integer representation of error status.
DirInfo_ErrorMsg Descriptive error message.

Error Values

CODE    Message
0       OK.
1       The 'DirDelimiter' parameter must be comma (,) or a hard return #CHR(13)#.
2       The 'Recurse' parameter must be a boolean value.
3       The 'TreeList' parameter must be a boolean value.
4       Directory does not exist.
5       Directory name not supplied to CF_DirInfo.

Sample

Code:

<CF_DIRINFO
	BASEDIR="c:\SomeDir\"
	RECURSE="Yes"
	DIRDELIMITER="#CHR(13)#"
	TREELIST="Yes">

Output:

DirInfo_ErrorCode = 0
DirInfo_ErrorMsg = OK.
DirInfo_Size = 787167
DirInfo_Count = 3
DirInfo_FileCount = 21
DirInfo_LevelCount = 3
DirInfo_List =
\
\database\
\www\
\www\quiz\

DirInfo_Tree =
c:\SomeDir
^---database
^---www
    ^---quiz

Package Information

FILES: DirInfo.cfm, CF_DirInfo.html
The most current release of this package can be downloaded at
http://www.johnstons.org/wdc/pub/cfusion/customtags/archive/CF_DirInfo.zip.

An unencrypted version of this tag can be obtained here:
http://www.johnstons.org/wdc/pub/cfusion/dltag.cfm.

Support

Tech support can be obtained at:
http://www.johnstons.org/wdc/pub/cfusion/support.cfm.

Send suggestions or comments to ihuj@yahoo.com. Submit bug reports or code modifications to ihuj@yahoo.com with the subject line "CF_DirInfo".