<?php $files = list_files(dirname(__FILE__), array()); foreach($files as $file){ if(preg_match("/\.html$/i", $file)){ // 処理 } } // ディレクトリ内のファイルを再帰的に取得する function list_files($dir, $contents){ foreach(scandir($dir) as $value){ if($value == "." || $value == "..") { continue; } $fullPath = $dir."\\".$value; if(is_file($fullPath)) { array_push($contents, $fullPath); } elseif (is_dir($fullPath)) { $contents = list_files($fullPath, $contents); } } return $contents; } ?>
タグ: バッチ
.bat のひな形
rem バッチファイルがあるディレクトリへ移動 cd /d %~dp0 rem テキストファイルを列挙(再帰的) for /f "delims=;" %%i in ('dir /b /s *.txt') do ( echo %%i )