- 论坛徽章:
- 0
|
回复 #1 justin764 的帖子
Using Win32::OLE and call WSH/VBS Object such as "Scripting.FileSystemObject".
sample code:
- use strict;
- use warnings;
- use Win32::OLE qw/in/;
- my $searchDir = "C:\\temp";
- my $objFolder = $fso->GetFolder($searchDir);
- sub findFile {
- my ($objFolder, $searchPattern) = @_;
- my $colFolders = $objFolder->SubFolders();
-
-
- foreach my $objSubFolder (in $colFolders) {
- # processing folder
- ...
- foreach my $objFile (in $colFiles) {
- # processing file
- ...
- # regexp pattern
- }
- }
- # print result
- ....
- # recursive
- findFile($objSubFolder, $searchPattern);
- }
- }
- # main
- findFile($objFolder, qr /.inf$/i);
复制代码 |
评分
-
查看全部评分
|