App-rsync-new2old

 view release on metacpan or  search on metacpan

script/newest-mtime  view on Meta::CPAN

our $VERSION = '0.008'; # VERSION

use strict;
use warnings;

use Getopt::Long;

sub find_newest_mtime {
    my $path = shift;

    my @st = lstat($path) or return (0, $path);
    my $is_dir = (-d _);
    my $mtime = $st[9];
    if ($is_dir) {
        opendir my($dh), $path or do {
            warn "newest-mtime: Can't opendir $path: $!, skipped\n";
            return (undef, $path);
        };
        my @entries = grep { $_ ne '.' && $_ ne '..' } readdir($dh);
        my @res = map { [find_newest_mtime("$path/$_")] } @entries;
        my $max_path = $path;

script/rsync-new2old  view on Meta::CPAN

    my $path = shift;
    my $path_ends_in_slash = $path =~ s{/+\z}{} ? 1:0;
    my $abs_path = File::Spec->rel2abs($path);
    my (undef, undef, $path_leaf) = File::Spec->splitpath($abs_path);
    return ($abs_path, $path_leaf, $path_ends_in_slash);
}

sub find_newest_mtime {
    my $path = shift;

    my @st = lstat($path) or return (0, $path);
    my $is_dir = (-d _);
    my $mtime = $st[9];
    if ($is_dir) {
        opendir my($dh), $path
            or die "rsync-new2old: Can't opendir $path: $!\n";
        my @entries = grep { $_ ne '.' && $_ ne '..' } readdir($dh);
        my @res = map { [find_newest_mtime("$path/$_")] } @entries;
        my $max_path = $path;
        my $max_mtime = $mtime;
        for my $r (@res) {



( run in 0.526 second using v1.01-cache-2.11-cpan-49f99fa48dc )