<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>CFDIRECTORY</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="説明">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">CFDIRECTORY</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">説明</span>
<p>
ディレクトリに関する操作を管理します。
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">カテゴリ</span>
<p>
ファイル管理タグ
</p>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="syntax"><span class="title">シンタックス</span><pre>&lt;cfdirectory
   action = &quot;directory action&quot;
   directory = &quot;directory name&quot;
   name = &quot;query name&quot;
   filter = &quot;list filter&quot;
   mode = &quot;permission&quot;
   sort = &quot;sort specification&quot;
   newDirectory = &quot;new directory name&quot;
   recurse = &quot;yes&quot;、&quot;no&quot;&gt;
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">関連項目</span>
<p>
cffile
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">ヒストリ</span>
<p>
ColdFusion&#160;MX&#160;7: recurse 属性 (Alpha 1 では recursive) と directory 結果セット列が追加されました。
</p>

<p>
ColdFusion&#160;MX: 
</p>
<ul>

<li>action = &quot;list&quot; の動作が変更されました。</li>
<ul>

<li>Windows の場合、cfdirectory タグで action = &quot;list&quot; を指定したときに、現在のディレクトリとその親ディレクトリを表す &quot;.&quot; (ドット) または &quot;..&quot; (二重ドット) のディレクトリエントリは返されなくなりました。</li>

<li>Windows の場合、cfdirectory タグで action = &quot;list&quot; を指定したときに、Archive 属性と System 属性の値が返されなくなりました。</li>

<li>UNIX および Linux の場合、cfdirectory タグで action = &quot;list&quot; を指定したときに、mode 列の情報は返されなくなりました。</li>
</ul>
</ul>

<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">使用方法</span>
<p>
複数のカスタマが使用するサーバーに ColdFusion アプリケーションを置く場合、未認可のユーザーがアップロードできる、またはこのタグで操作できるファイルおよびディレクトリについて、セキュリティを考慮する必要があります。ColdFusion タグを保護する方法については、『ColdFusion&#160;MX の設定と管理』を参照してください。
</p>

<p>
action = &quot;list&quot; の場合、cfdirectory によって次の結果列が返されます。これらの結果列は cfoutput タグ内で参照できます。
</p>
<ul>

<li>name: ディレクトリエントリ名です。&quot;.&quot; と &quot;..&quot; のエントリは返されません。 </li>

<li>directory: エントリを含むディレクトリです。</li>

<li>size: ディレクトリエントリのサイズです。</li>

<li>type: ファイルタイプです。ファイルの場合は File、ディレクトリの場合は Dir です。</li>

<li>dateLastModified: エントリの最終修正日です。</li>

<li>attributes: ファイル属性です。適用できる場合に限ります。</li>

<li>mode: 空の列です。UNIX の ColdFusion 5 アプリケーションとの下位互換性を保つために残されています。</li>
</ul>

<p>
次の結果列は、標準 CFML 式で使用することができます。結果列名の先頭には、クエリー名が付けられます。
</p>
<pre>#mydirectory.name#
#mydirectory.directory#
#mydirectory.size#
#mydirectory.type#
#mydirectory.dateLastModified#
#mydirectory.attributes#
#mydirectory.mode#
</pre><table>
  <tr valign="top">
    <td width="30"><strong>メモ: </strong></td>
    <td>cfdirectory タグが機能していないように見える場合 (たとえば list オペレーションで空の結果セットが返される場合) は、そのディレクトリにアクセスする正しい権限を持っているかどうかを確認してください。たとえば、ColdFusion を Windows 上のサービスとして実行している場合、ColdFusion はデフォルトで System として機能し、リモートシステムやマップされたドライブ上のディレクトリにはアクセスできません。この問題を解決するには、ローカルシステムアカウントでは ColdFusion を実行しないでください。</td>
  </tr>
</table>
<p>
filter 属性には、1 つまたは複数の文字のパターンを指定します。このパターンに一致する名前はすべて結果リストに含まれます。Windows システムではパターンマッチングの際に大文字と小文字は無視され、UNIX および Linux では大文字と小文字は区別されます。 
</p>

<p>
次の 2 つの文字はパターン内で特別な意味を持ち、メタ文字と呼ばれます。 
</p>
<ul>

<li>*&#160;0 個以上の任意の文字に一致させます。</li>

<li>?&#160;任意の 1 文字に一致させます。</li>
</ul>

<p>
次の表に、パターンとそれに一致するファイル名の例を示します。
</p>

<p>
</p><div align="left">
<table border="1">
  <caption></caption>
  <tr align="center">    <th><strong>パターン</strong></th>
    <th><strong>一致するファイル</strong></th>
</tr>
  <tr align="left">    <td>
<p>foo.*</p></td>
    <td>
<p>任意の拡張子を持つ、foo という名前のファイル (例 : foo.html、foo.cfm、foo.xml)</p></td>
</tr>
  <tr align="left">    <td>
<p>*.html</p></td>
    <td>
<p>.html という拡張子を持つすべてのファイル (.htm という拡張子のファイルは含まれない)</p></td>
</tr>
  <tr align="left">    <td>
<p>??</p></td>
    <td>
<p>2 文字の名前を持つすべてのファイル</p></td>
</tr>
</table>
</div>
<p>
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">例</span><pre>&lt;!--- 例 1: ディレクトリの作成と名前変更
ColdFusion のエラーメッセージが生成されないようにするために、ディレクトリが存在することを確認します。 ---
&gt;
&lt;cfset newDirectory = &quot;otherNewDir&quot;&gt;
&lt;cfset currentDirectory = GetDirectoryFromPath(GetTemplatePath()) &amp; &quot;newDir&quot;&gt;
&lt;!--- ディレクトリが存在するかどうかを確認します。 ---&gt;
&lt;cfif DirectoryExists(currentDirectory)&gt;
&lt;!--- TRUE の場合、ディレクトリの名前を変更します。 ---&gt; 
   &lt;cfdirectory action = &quot;rename&quot; directory = &quot;#currentDirectory#&quot; newDirectory = 
&quot;#newDirectory#&quot; &gt;
   &lt;cfoutput&gt;
   &lt;p&gt;ディレクトリが存在し、その名前は次のように変更されました : #newDirectory#&lt;/p&gt;
   &lt;/cfoutput&gt;
&lt;cfelse&gt;
   &lt;!--- FALSE の場合、ディレクトリを作成します。 ---&gt;
   &lt;cfdirectory action = &quot;create&quot; directory = &quot;#currentDirectory#&quot; &gt;
   &lt;cfoutput&gt;&lt;p&gt;ディレクトリが作成されました。&lt;/p&gt;&lt;/cfoutput&gt;
&lt;/cfif&gt;

&lt;!--- 例 2: ディレクトリの削除
Coldfusion のエラーメッセージが生成されないようにするために、
ディレクトリが存在すること、およびそのディレクトリ内にファイルがないことを確認します。 ---&gt;

&lt;cfset currentDirectory = GetDirectoryFromPath(GetTemplatePath()) &amp; &quot;otherNewDir&quot;&gt;
&lt;!--- ディレクトリが存在するかどうかを確認します。 ---&gt;
&lt;cfif DirectoryExists(currentDirectory)&gt;
   &lt;!--- TRUE の場合、ディレクトリ内にファイルがあるかどうかを削除前に確認します。 ---&gt;
   &lt;cfdirectory action=&quot;list&quot; directory=&quot;#currentDirectory#&quot; 
   name=&quot;myDirectory&quot;&gt;
   &lt;cfif myDirectory.recordcount gt 0&gt;
   &lt;!--- TRUE の場合、ディレクトリからファイルを削除します。 ---&gt;
      &lt;cfoutput&gt;
      &lt;p&gt;ファイルはこのディレクトリに存在します。ファイルを削除するか、削除するためのコードを
         実行します。&lt;/P&gt;
      &lt;/cfoutput&gt; 
   &lt;cfelse&gt;
   &lt;!--- ディレクトリが空の場合 - ディレクトリを削除します。 ---&gt;
      &lt;cfdirectory action = &quot;delete&quot; directory = &quot;#currentDirectory#&quot;&gt;
      &lt;cfoutput&gt;
      &lt;p&gt;ディレクトリが存在しますが、削除されました。&lt;/P&gt;
      &lt;/cfoutput&gt;
   &lt;/cfif&gt; 
&lt;cfelse&gt;
   &lt;!--- FALSE の場合、メッセージを送信するか、他の関数を実行します。 ---&gt;
   &lt;cfoutput&gt;&lt;p&gt;ディレクトリは存在しませんでした。&lt;/p&gt;&lt;/cfoutput&gt;
&lt;/cfif&gt; 
&lt;!--- 例 3: ディレクトリの一覧表示
次の例では、ディレクトリ名の配列、およびディレクトリのみに関するエントリを含む
クエリーを作成します。 ---&gt;

&lt;cfdirectory directory=&quot;C:/temp&quot; name=&quot;dirQuery&quot; action=&quot;LIST&quot;&gt;

&lt;!--- ディレクトリ名の配列を取得します。 ---&gt;
&lt;cfset dirsArray=arraynew(1)&gt;
&lt;cfset i=1&gt;
&lt;cfloop query=&quot;dirQuery&quot;&gt;
&lt;cfif dirQuery.type IS &quot;dir&quot;&gt;
   &lt;cfset dirsArray[i]=dirQuery.name&gt;
   &lt;cfset i = i + 1&gt;
&lt;/cfif&gt;
&lt;/cfloop&gt;
&lt;cfdump var=&quot;#dirsArray#&quot;&gt;
&lt;br&gt;
&lt;!--- クエリーオブクエリー内のディレクトリ情報をすべて取得します。---&gt;
&lt;cfquery dbtype=&quot;query&quot; name=&quot;dirsOnly&quot;&gt;
SELECT * FROM dirQuery
WHERE TYPE=&#39;Dir&#39;
&lt;/cfquery&gt;
&lt;cfdump var=&quot;#dirsOnly#&quot;&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="ACTION">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">ACTION</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "List"

<ul>

<li>list: 指定されたディレクトリにあるファイルのクエリーレコードセットを返します。現在のディレクトリと親ディレクトリを表す &quot;.&quot; (ドット) と &quot;..&quot; (二重ドット) のディレクトリエントリは返されません。 </li>

<li>create</li>

<li>delete</li>

<li>rename</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="DIRECTORY">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">DIRECTORY</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">必須</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>アクションを実行する対象ディレクトリの絶対パス名です。 </p>
<p>次の例のように IP アドレスを使用できます。</p><pre>&lt;cfdirectory directory=&quot;//12.3.123.123/c_drive/&quot; 
name=&quot;dirQuery&quot; action=&quot;LIST&quot;&gt;
</pre>

  </td>
  </tr>
  </table>
</div>
<div id="NAME">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">NAME</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">action = &quot;list&quot; の場合は必須</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>出力レコードセットの名前です。 </p>

  </td>
  </tr>
  </table>
</div>
<div id="FILTER">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">FILTER</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">action = &quot;list&quot; の場合はオプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>返される名前に適用するファイル拡張子のフィルタです。たとえば、*.cfm などです。適用できるフィルタは 1 つだけです。 </p>

  </td>
  </tr>
  </table>
</div>
<div id="MODE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">MODE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>action = &quot;create&quot; と共に使用し、許可を表します。UNIX および Linux だけに適用されます。chmod コマンドの 8 進数値を使用し、所有者、グループ、および他の利用者それぞれに割り当てられます。例 :  </p><ul>

<li>644: 所有者に読み取り/書き込み許可、グループおよび他の利用者に読み取り許可を割り当てます。</li>

<li>777: 利用者全員に読み取り/書き込み/実行許可を割り当てます。</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="SORT">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">SORT</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション (action = &quot;list&quot; の場合に使用)</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "ASC"


<p>ディレクトリリストのソートに使用するクエリー列です。クエリー出力に含まれる列をカンマ区切りのリストで指定します。 </p>
<p>列に条件を付ける場合は、次の値を使用します。</p><ul>

<li>asc: 昇順 (a ～ z) のソートです。 </li>

<li>desc: 降順 (z ～ a) のソートです。 </li>
</ul>

<p>例 : </p>
<p>sort = &quot;directory ASC, size DESC, datelastmodified&quot;</p>

  </td>
  </tr>
  </table>
</div>
<div id="NEWDIRECTORY">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">NEWDIRECTORY</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">action = &quot;rename&quot; の場合は必須</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>ディレクトリの新規名です。</p>

  </td>
  </tr>
  </table>
</div>
<div id="RECURSE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">RECURSE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "no"


<p>ColdFusion でサブディレクトリ上のアクションを実行するかどうかを指定します。</p><ul>

<li>yes</li>

<li>no</li>
</ul>

<p>action=&quot;list&quot; および action=&quot;delete&quot; の場合に有効です。</p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
