Select a batch of files from a path pattern(only the last folder changes)
来源:互联网 发布:阿里云ftp文件上传 编辑:程序博客网 时间:2024/05/17 01:44
sub SelectFiles($$$$;$$){
my ($srcPathPattern, $srcFile, $desPath, $desFile) = @_;
my $srcPath = dirname($srcPathPattern);
my $folderPattern = basename($srcPathPattern);
#print "$srcPathPattern, $srcPath, $folderPattern\n";
my @folders;
opendir DH, $srcPath or die("Can't open dir: $srcPath\n");
foreach my $folder(readdir DH) {
#print "\none file in $srcPath is $folder\n";
if($folder =~ /$folderPattern/){
push(@folders, $folder);
}
}
@folders = sort @folders;
#print "@folders\n";
closedir(DH);
my @files;
foreach(@folders){
my $dirTmp = PathConnection($srcPath, $_);
#print "$dirTmp\n";
opendir DH_Tmp, $dirTmp or die("Can't open dir: $dirTmp\n");
foreach my $file(readdir DH_Tmp) {
#print "one file in $dirTmp is $file\n";
if($file =~ /$srcFile/){
my $fullpathfile = PathConnection($dirTmp, $file);
push(@files, $fullpathfile);
}
}
closedir(DH_Tmp);
}
@files = sort @files;
#print "@files\n";
return $TRUE;
}
my ($srcPathPattern, $srcFile, $desPath, $desFile) = @_;
my $srcPath = dirname($srcPathPattern);
my $folderPattern = basename($srcPathPattern);
#print "$srcPathPattern, $srcPath, $folderPattern\n";
my @folders;
opendir DH, $srcPath or die("Can't open dir: $srcPath\n");
foreach my $folder(readdir DH) {
#print "\none file in $srcPath is $folder\n";
if($folder =~ /$folderPattern/){
push(@folders, $folder);
}
}
@folders = sort @folders;
#print "@folders\n";
closedir(DH);
my @files;
foreach(@folders){
my $dirTmp = PathConnection($srcPath, $_);
#print "$dirTmp\n";
opendir DH_Tmp, $dirTmp or die("Can't open dir: $dirTmp\n");
foreach my $file(readdir DH_Tmp) {
#print "one file in $dirTmp is $file\n";
if($file =~ /$srcFile/){
my $fullpathfile = PathConnection($dirTmp, $file);
push(@files, $fullpathfile);
}
}
closedir(DH_Tmp);
}
@files = sort @files;
#print "@files\n";
return $TRUE;
}
- Select a batch of files from a path pattern(only the last folder changes)
- How to get a notification from Linux when the set of network interfaces changes
- Select a Folder
- Use matlab to traverse the files in a folder
- Make sure the content of your adapter is not modified from a background thread, but only from the UI
- make sure the content of your adapter is not modified from a background thread . but only from the
- make sure the content of your adapter is not modified from a background thread . but only from the
- make sure the content of your adapter is not modified from a background thread . but only from the
- delete specific lines in a set of files in a folder
- Print the bit pattern of a float
- Displaying the 'Properties' of a file or folder.
- Getting Information About the Contents of a Folder
- The folder is already a source folder
- The folder is already a source folder
- Read all files in a folder
- 69.You need to generate a list of all customer last names with their credit limits from the CUSTOMER
- A - Shortest path of the king
- A. Shortest path of the king
- 利用JavaScript 控制CheckBoxList来进行 全选与不选
- 汇编语言,找出最大值与最小值
- fcntl设置FD_CLOEXEC标志作用
- Linux 新增系统调用的启示
- (2011.11.02)汇编_王爽_第11章_学习小结
- Select a batch of files from a path pattern(only the last folder changes)
- 认识下“五险一金”
- 利用JavaScrip 获得QueryString 参数的 值的函数
- 使用sencha touch控件显示twitter信息
- Template method pattern
- 汇编语言,将ASCII码十进制数转换为二进制数
- android程序换皮肤之一
- 赫耳墨斯与手艺人
- 跋涉不止(1)