Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use utf8;
- use open qw|:std :encoding(utf8)|;
- use File::Find;
- use Encode;
- use vars qw/*name *dir *prune/;
- *name = *File::Find::name;
- *dir = *File::Find::dir;
- *prune = *File::Find::prune;
- sub wanted;
- my $f1 = '/tmp/test.txt';
- my $f2 = '/tmp/test2.txt';
- open my $in, '<', $f1 or die $!;
- open my $out, '>', $f2 or die $!;
- my $before = select($out);
- File::Find::find({ wanted => \&wanted },
- map { chomp; </home/$_/work/*/new/> } <$in>);
- select($before);
- close $in;
- close $out;
- exit;
- sub wanted {
- my ($dev,$ino,$mode,$nlink,$uid,$gid);
- $_ = Encode::decode('utf-8', $_);
- (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
- -f _ &&
- (int(-M _) > 90) &&
- ! /(?:\p{Hiragana}|\p{Katakana}|\p{Han})/s
- && print Encode::encode('utf-8', $name)."\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement