findで2階層以下のファイルも出力するにはどうすればいいか知りたいです。
フォルダ構成は以下です
スクリプト
#!/usr/bin/perl -- use strict; use File::Find; find(\&process, "httpdocs"); sub process{ print $File::Find::name . "\n"; }
実行した出力は以下
test.html、ok.htmlも出力したいです。
httpdocs httpdocs/index.html httpdocs/test httpdocs/test2
以下のリンクでは再帰的に処理と説明しているので、
test.html、ok.htmlも出力してくれると思っていたのですがうまく行きません。
https://tutorial.perlzemi.com/blog/20080530121229.html
ヒントでもいいので助けて頂けると助かります。
追記
root@8c170ce2fb8a:/var/www/perl_test# perl perl_test_find.pl httpdocs httpdocs/index.html httpdocs/test httpdocs/test2 root@8c170ce2fb8a:/var/www/perl_test/httpdocs# ls -l total 1 -rwxr-xr-x 1 root root 274 Aug 22 11:51 index.html drwxrwxrwx 2 root root 0 Aug 22 11:34 test drwxrwxrwx 2 root root 0 Aug 22 11:34 test2 root@8c170ce2fb8a:/var/www/perl_test/httpdocs/test# ls -l total 1 -rwxr-xr-x 1 root root 276 Aug 22 11:17 test.html
回答2件
あなたの回答
tips
プレビュー