金鳞

目标->软件测试架构师


@rem = '--*-Perl-*--
@echo off
if "%OS%" == "Windows_NT" goto WinNT
perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
:WinNT
perl -x -S %0 %*
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
if %errorlevel% == 9009 echo You do not have Perl in your PATH.
if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
goto endofperl
@rem ';
#!/usr/local/bin/perl -w
#line 15
use strict;
use File::Find;
my $path = ".";
find(\&process, $path);
sub process
{
     
         my $dir = $File::Find::dir;
         $dir =~ s/^\.\///;
         $dir =~ s/\//\\/g;
         print "'$_' is in the directory of".$dir."
\\".$_,"\n";
        }
exit 0;
__END__
:endofperl


1 复制上述代码,存储到一个新批处理文件中,如rlist.bat
2 把rlist.bat拷备到需要列出所有文件的目录下
3 通过命令行窗口执行rlist.bat > flist.txt,文件列表就会存储到重定向文件flist.txt中

感谢那个哥们的blog,嘿嘿!
posted on 2008-12-16 22:47 金鳞 阅读(2204) 评论(3)  编辑 收藏 引用 所属分类: perl-File::Find

评论

# re: 获取当前目录下的所有文件列表及目录 2010-05-25 11:29 rthyu
perl 编译通不过  回复  更多评论
  

# re: 获取当前目录下的所有文件列表及目录 2010-07-11 12:15 金鳞
我的编译是通过的没问题的,把上述内容存到记事本中,文件命名以.pl结尾,然后perl test.pl,回车,直接打印出结果。

那么,您的报错信息是啥?

@rthyu
  回复  更多评论
  

只有注册用户登录后才能发表评论。