This morning I was reading an entry by Ben Nadel
on using single character wild cards. The article was a good one and I learned something new but I also posted comment saying how it would be great if we could use multiple filters. Steve Withington
posted a response showing that indeed you could do this. This of course had me a little confused because I was always told that you could only use one filter. If your not sure what I am talking about lets look at the following example. The following example reads a directory named cfgrid and does not apply any filters and therefore will list the entire contents of the directory.
As you can see from the example above the entire directory is listed. The directory contains png,cfm & cfc file extensions. If we wanted to list just the png files we could apply a filter to the results.
1<cfset filters = "*.png">
2<cfdirectory action="list" directory="#ExpandPath('.')#/cfgrid"
3filter="#filters#" listinfo="name" name="dir">
I was always told that you could only filter by one file extension. In fact this is right from the docs which would really back up that statement.
File extension filter applied to returned names, for example, *.cfm. One filter can be applied.
As I noted earlier you learn something new everyday. Here is an example of how to create multiple filters.
1<cfset filters = "*.cfm|*.cfc">
2<cfdirectory action="list" directory="#ExpandPath('.')#/cfgrid" filter="#filters#" listinfo="name" name="dir">