Leser: 1
10 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/perl
use strict;
use warnings;
my $directory = '/path/to/directory/';
my $accesstime = 2; # letzter Zugriff vor 2 Tagen
opendir(DIR,$directory) or die $!;
my @files = grep{$_ !~ /\.\.?$/}readdir(DIR);
closedir DIR;
for my $file(@files){
my $filename = $directory . '/' . $file;
if(-f $filename and -A $filename >= $accesstime){
unlink $filename;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/perl
use strict;
use warnings;
my $dir = '/directory/';
my $last_access = 2;
opendir(DIR,$dir) or die $!;
my @files = grep{-f $_ and -A $_ >= $last_access}map{$dir.'/'.$_}grep{$_ !~ /\.\.?$/}readdir(DIR);
closedir DIR;
unlink @files;
grep{$_ !~ /\.\.?$/}readdir(DIR);
grep{$_
!
/\.\.?/
grep{!($_ =~ /\.\.?$/)}readdir(DIR);
grep{$_ !~ /^\.\.?$/}readdir(DIR);
10 Einträge, 1 Seite |