App-Bin4TSV
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
scripts/lastaccess view on Meta::CPAN
#!/usr/bin/perl
use 5.014 ; use strict ; use warnings ;
use File::Find ;
use Time::HiRes qw[ stat tv_interval time gettimeofday ] ;
use Getopt::Std ; getopts ',:d:g:x:',\my %o ;
use Term::ANSIColor qw[ :constants ] ; $Term::ANSIColor::AUTORESET = 1 ;
use Pod::Perldoc ;
use feature qw[ say ] ;
$o{d} //= 1 ; # ãã£ã¬ãã¯ãªã«å¯¾ããå¦çãæå¶ãããã©ããã0ãæ示çã«ä¸ãããããæå¶ã
$o{g} //= 12 ; # æè¿ã¢ã¯ã»ã¹ããããã¡ã¤ã«ãæ大ä½ååãåºãã
my $start_time = [ gettimeofday ] ;
main () ; exit 0 ;
sub main {
my @sdir = defined $o{x} ? ($o{x}) : @ARGV ? @ARGV : qw[ . ] ;
our @ Files = () ;
find ( { wanted => \& wanted , no_chdir => 1 } , @sdir ) ;
sub wanted {
my @s = stat $_ ;
my $atime = $s[8] ;
my $bytes = $s[7] ;
push @ Files , ff->new ( $_ , $atime, $bytes ) if ! ( -d _ && do { $_.='/' ;1} ) || $o{d} ;
}
my $now = time ;
$_ ->{ elapsed } = $now - $_->{atime} for @Files ;
@ Files = sort { $a ->{elapsed} <=> $b->{elapsed} } @Files ;
say join "\t", "Diff_seconds", "Seconds_before", "Byte_size", "File_name" ;
my $mrec0 = 0 ;
my $shown = 0 ;
for ( splice @Files , 0 , $o{g} ) {
my @t ;
my $mrec = $_->{elapsed} ;
push @t , sprintf "%0.6f" , $mrec - $mrec0 ;
push @t , sprintf "%0.6f" , $mrec ;
push @t , $_->{bytes}, $_->{name} ;
$t[2] =~ s/(?<=\d)(?=(\d\d\d)+($|\D))/,/g if $o{','} // '' ne "0" ;
say join "\t" , @t ;
$shown ++ ;
$mrec0 = $mrec ;
}
my $num = @ Files ;
my $elps = sprintf "%.6f" , tv_interval $start_time ;
say STDERR CYAN "Files processed : $num ; Shown above : $shown ; Elapsed seconds : $elps" ;
}
sub HELP_MESSAGE { # <-- - ãµãã³ãã³ããå¼ã°ãã¦ããã¨ãã¯ãã®ãã«ããå¼ã°ããã
local @ARGV = do { my ($x,@y) = 0 ; 1 while ( @y = caller $x++ )[ 0 ] eq "Getopt::Std" ; $y[1] } ;
Pod::Perldoc -> run ;
}
sub VERSION_MESSAGE { $ Getopt::Std::STANDARD_HELP_VERSION = 1 } # <- here?
package ff ;
sub new ( $ ) { #say 1 ;
my $ins = { name => $_[1] , atime => $_[2] , bytes => $_[3] } ;
return bless $ins ;
}
=encoding utf8
=head1 NAME
lastaccess DIRNAME
DIRNAMEã®ä¸ã«ãããã¡ã¤ã«ã§ãæå¾ã«ã¢ã¯ã»ã¹ãããé ã«ãã¡ã¤ã«ã表示ããã
ãªãã·ã§ã³:
-d 0 ; éä¸ã§ç¾ãããã£ã¬ã¯ããªã«å¯¾ããå¦çãæå¶ããã
-g N : æ大æè¿ã®ä½åãåãåºããã®æå®ãæªæå®ãªã12ã
-x STR : DIRNAME ã®æå®
-, 0 : 3æ¡åºåãã®ã³ã³ããæå¶ããã
éçºã¡ã¢ :
* ã½ã¼ããè¡ã£ã¦ããã®ã§ãæ°åä¸åãè¶
ãããã¡ã¤ã«ããã®ä¸ã®é層ã®ã©ããã«ããå ´åã¯è¨ç®ãªã½ã¼ã¹ãæ°ã«ãªãã工夫ãå¿
è¦ã
* åãã¡ã¤ã«ã®ãã¹ã®æååããã®ã¾ã¾ã¡ã¢ãªä¸ã«è¼ãã¦ããã®ã§ããã¹åã§ã¯ãªããã ã®ãã¡ã¤ã«åã§ååãªã¯ãããä½åãç¡é§ããã¦ãããæ¹è¯ãããã
=cut
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.446 second using v1.00-cache-2.02-grep-82fe00e-cpan-cec75d87357c )