利用sourceInsight的搜索结果“×.SearchResults”文件,提取文件到指定目录下。
使用这个脚本,要注意的是你在利用sourceInsight搜索时要充分保证能把文件都搜索出来。
代码如下:
#!usr/bin/perl
##
## getfile.pl test.SearchResults F:\test
##
## 用来根据sourceinsight的搜索结果"*.SearchResults"文件提取目标文件
##
## sourceinsight的搜索结果一般为"filename (path) : ..."
## 如果"(path)"为空说明为file在当前目录下, 否则表示file在当前目录的相对路径下
##
## 2013-07-17, first version.
##
use strict;
use File::Path;
use File::Copy;
my $rsltFile = ${ARGV[0]}; ##sourceInsight的搜索结果文件
my $workPath = ${ARGV[1]}; ##欲提取的文件源目录
my $destPath = ${ARGV[2]}; ##输出文件的存放目录
if ($rsltFile eq "" || $workPath eq "")
{
die "\nParameter error!\n[USAGE] $0 souceInsight_SearchResults_file work_path [output_path]\n";
}
print "\n----Process begin----\n\n";
$rsltFile =~ s/\\/\//g;
$workPath =~ s/\\/\//g;
if ($destPath eq "")
{
$destPath = $workPath."/__o