forked from OSInside/kiwi-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.lutime
executable file
·43 lines (32 loc) · 865 Bytes
/
.lutime
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
#!/usr/bin/perl
use strict;
use File::Find;
use File::stat;
use File::lchown qw( lutimes );
use POSIX qw( ENOENT );
my %reference;
my %result;
my $Source = $ARGV[0];
my $Target = $ARGV[1]."/kiwi";
sub generateWanted {
my $filehash = shift;
my $base = shift;
return sub {
if ((-l $File::Find::name) && (-e $File::Find::name)) {
my $file = $File::Find::name;
my $attr = lstat ($file);
$file =~ s/$base//;
$filehash->{$file} = $attr;
}
}
};
my $wref = generateWanted (\%reference,$Source);
find ({ wanted => $wref }, $Source );
my $wref = generateWanted (\%result,$Target);
find ({ wanted => $wref }, $Target );
foreach my $name (keys %result) {
my $atime;
my $mtime;
$atime = $mtime = $reference{$name}->mtime;
lutimes $atime, $mtime, $Target."/".$name;
}