PHP unix ディレクトリの通常ファイル個数を調べる

2010年02月17日(水)

unixのコマンドがphpで使える事すら危うかったです。
すごく損した気分です。

ありがとうございました。
http://shoyu-ramen23.jugem.jp/?eid=190

$target_dir = '/var/www/public_html/test/images/';

//コマンドの実行結果を受け取る配列
$result = array();

$command = "find " . $target_dir . " -type f | wc -l";
exec($command, $result);

//出力
echo '通常ファイル数は、' . $result[0];

find /var/www/public_html/test/images/ -type f | wc -l
というコマンドを送っているんですね。

Mac ターミナルのシェル変更方法

2010年02月01日(月)

いまごろこんなことやってる時点で、先がおもいやられます・・・

http://support.apple.com/kb/TA27005?viewlocale=ja_JP&locale=ja_JP

ちなみにシェルの確認方法は

echo $shell