Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

count no. of files

New Here ,
Jul 25, 2008 Jul 25, 2008
how could we count the no. of files (*.txt) in a directory?

a.txt
b.txt
c.doc
result should be 2.
TOPICS
Getting started
332
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 25, 2008 Jul 25, 2008
use cfdirectory tag with NAME and FILTER attributes, i.e.
<cfdirectory ... NAME="myDir" FILTER="*.txt">

then #myDir.recordcount# will give you the number of .txt files in your dir.

it's all in the docs, by the way...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jul 25, 2008 Jul 25, 2008
LATEST
Take a look at the file management category, specifically cfdirectory. You can use its "filter" attribute to search for text files only. Then use the result set "recordCount" to obtain the total number of files found.
http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags-pt0_11.html#2459859
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources