File and Directory Access

File and directory access.

Problems

Does CFFILE have a file size limit?
There is no specific limit on file size for CFFILE. However, CFFILE loads the file into the server'...

How can ColdFusion work with ZIP and JAR files?
Use the <cfzip> and the <cfzipparam> tags. <cfzip> provides access to ZIP and J...

How can I get a list of files in a directory?
Use the <cfdirectory> tag. Don't forget to use the recurse="true" attribute if you want the ...

How can I limit the size of a file when uploading with cffile?
You can use the cgi.content_length to find the file size. If the cgi.content_length is less than or ...

How can I read a simple text file, processing each line of the file?
ColdFusion makes it easy to read a file using the <cfloop> tag. By using the file attribute, y...

How can I read and write ColdFusion .log files?
ColdFusion log files are a form of text files that end in the .log extension and must be saved insid...

How can I read, set, or delete Windows system registry data?
Anyone who has worked with the Windows platform has probably encountered the system registry at one ...

How can I use ColdFusion to serve files that exist outside of the web root?
Use the <cfcontent> tag. You can set the file attribute to point to a file on any local or map...

How do I convert a list of files into links?
ColdFusion makes it easy to dynamically list out the files in a folder. Converting this list of file...

How do I delete a folder and all files and subfolders beneath it?
The tag has a delete action, but this will throw an error if there is anything in the ...

How do I find out if a specific file or directory exists on my ColdFusion server?
The directoryExists() function takes an absolute path as its only parameter. It will then test for ...

How do I find the file extension for a file?
Use the listLast() function. ...

How do I find the size of a directory?
Use the <cfdirectory> tag, and then do a query of queries on the results: In the exampl...

How do I get a listing of just the files or child directories in a directory?
You can use the cfdirectory tag with the list option, and then there are two ways to only display ...

How do I get information about a file?
Use the getFileInfo() function. GetFileInfo returns a structure with the following information:...

How do I get the directory for the current template?
Use the two ColdFusion functions getCurrentTemplatePath() and getDirectoryFromPath(). The fun...

How do I monitor a file directory for added/deleted/ changed files?
Event Gateways: Directory Watcher Open the ColdFusion Administrator and go to "EVENT GATEWAYS/Gat...

How do I prevent a file from becoming corrupt due to simultaneous access?
While working with files, it is important to lock them for single threaded access. If you do not, ...

How do I read and write binary files?
Working with binary files is very similar to working with text files. The main difference is that b...

How do I return a query from an Excel file?
NOTE: To use the below solution, your ColdFusion server must allow you to create Java objects. Many ...

How do you determine the amount of free space on a volume?
Currently there is no native ColdFusion functionality to accomplish this task. If ColdFusion can't d...