安徽屯溪,哈尔滨的雪地,扬州的瘦西湖,想必知道我是谁了吧!!对,小金思密达
分类: PERL
2015-01-04 15:23:59
##用到的函数
opendir DIRHANDLE, EXPR # To open a directory
readdir DIRHANDLE # To read a directory
rewinddir DIRHANDLE # Positioning pointer to the begining
telldir DIRHANDLE # Returns current position of the dir
closedir DIRHANDLE # Closing a directory.
例如:
#!/usr/bin/perl -w
opendir (FH, "file_dir") or die "can't open the directory,$!";
while (my $file_t=readdir FH){
foreach ( grep (/^.*\.name$/,readdir(FH))){
if ($_=~/^$/g){ delete $_;}else {....} #处理对象$_,每个文件
}
}
exit;