Pete Freitag Pete Freitag

Counting files

linux

In order to set the Maximum number of cached templates setting in ColdFusion MX Administrator, you need to know how many CFM files you have on your server. An easy way to find this out on Unix is by running the find command and piping it with grep -c (to count the number of matches) for example:

find /web/root | grep -c \.cfm$

The result will be the number of cfm files you have in your web root.ls


Like this? Follow me ↯

Counting files was first published on September 15, 2004.

If you like reading about linux, bash, or tips then you might also like:

Want Security Advisories via Email?

Advisory Week is a new weekly email containing security advisories published by major software vendors (Adobe, Apple, Microsoft, etc).

Comments

I wonder if it would also be good to add <pre>find /web/root | grep -c \.cfc$</pre> (CFCs) to that total, then round up?
by Cameron Childress on 09/15/2004 at 7:06:57 PM UTC
Good point, I would assume that CFCs are part of the template cache as well, but I don't know for sure.
by Pete Freitag on 09/15/2004 at 11:31:13 PM UTC
// counts .cfc and .cfm files, case insensitve
// only counts regular files (not directories)
//
find /web/root -type f -iname "*.cf[cm]" | wc -l
by sporter on 09/16/2004 at 1:14:38 AM UTC