Menu

[8c03dd]: / imv_dm.pm  Maximize  Restore  History

Download this file

48 lines (41 with data), 809 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/local/bin/perl
package DM;
use strict; use warnings;
use feature qw/say/;
use Encode qw/decode find_encoding/;
use File::Find qw/find/;
use Cwd qw/getcwd/;
my $valid_file;
my ($nfound,$nskip);
my $enc;
my $ignore_dotfile;
my ($dirp,$udir);
sub get_flist
{
$valid_file = $_[0];
$ignore_dotfile = $_[1];
$enc = find_encoding("UTF-8") unless $enc;
$dirp="...";
$nfound=$nskip=0;
find \&wanted, $_[2];
return ($nfound,$nskip);
}
sub wanted
{
return unless -f $_;
$nfound++;
my $dirc=getcwd;
if($dirc ne $dirp){
$udir=$enc->decode($dirc)."/";
$dirp=$dirc;
}
$nskip++;
my $f=$enc->decode($_);
if($ignore_dotfile&&($udir=~/\/\./||$f=~/^\./)){
print "#WARN:Skip: $udir$f\n";
return;
}
$nskip--;
&$valid_file($udir.$f);
}
1;
MongoDB Logo MongoDB