From nobody Fri May 05 07:51:37 2023 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QCNDZ0dy7z48yTK for ; Fri, 5 May 2023 07:51:42 +0000 (UTC) (envelope-from kayasaman@optiplex-networks.com) Received: from mail.optiplex-networks.com (mail.optiplex-networks.com [212.159.80.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4QCNDX73wPz4Lcm for ; Fri, 5 May 2023 07:51:40 +0000 (UTC) (envelope-from kayasaman@optiplex-networks.com) Authentication-Results: mx1.freebsd.org; none Received: from localhost (localhost [127.0.0.1]) by mail.optiplex-networks.com (Postfix) with ESMTP id 1485115C38B0; Fri, 5 May 2023 08:51:39 +0100 (BST) Received: from mail.optiplex-networks.com ([127.0.0.1]) by localhost (mail.optiplex-networks.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id VFR2OQdliila; Fri, 5 May 2023 08:51:38 +0100 (BST) Received: from localhost (localhost [127.0.0.1]) by mail.optiplex-networks.com (Postfix) with ESMTP id 3CD6115C38B1; Fri, 5 May 2023 08:51:38 +0100 (BST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.optiplex-networks.com 3CD6115C38B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=optiplex-networks.com; s=AE93A2AC-7F67-11EA-90AE-8A1FE64F6997; t=1683273098; bh=m9oIvNkFPtCKlwnT5CSdulx72IEJncXiaUfOlYm+h2E=; h=Message-ID:Date:MIME-Version:To:From; b=icymbPhRLnwq0Ljn8Ydkckf0C2WXORD0v166TuPUcdha50093VaB5SwkIGiuLs+la D2PZowDpYiHPxaQV71qNCdPou6HfebZLoRp4QcYcbbwNrV/1+CT7cLF5v8ViJq+CY9 1WOgNYzapS1QMIpSyA45UspxxyXSZG0fhqLQgHm2gPE4VuL4eQ7M/JRE+W3a43VxgI pBElDWifis9KbQU0GqmzrXQUVjkeTOCCdD9vNQ6iwppoFhCihUctIO/8VV1xmAKO8Q eFxtGZOTeu9EOdtWCLEo6Nb950cA22QR9bGI2GVyZOt2lRtYXXjU2M6BCAms+HHPXE E2RoGKpPRQxIQ== X-Virus-Scanned: amavisd-new at mail.optiplex-networks.com Received: from mail.optiplex-networks.com ([127.0.0.1]) by localhost (mail.optiplex-networks.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id lLa2vzLdmxaC; Fri, 5 May 2023 08:51:38 +0100 (BST) Received: from [192.168.20.23] (unknown [192.168.20.23]) by mail.optiplex-networks.com (Postfix) with ESMTPSA id 1548815C38B0; Fri, 5 May 2023 08:51:38 +0100 (BST) Content-Type: multipart/alternative; boundary="------------SiM7Cf9U9LS10HeJGopQNN7n" Message-ID: Date: Fri, 5 May 2023 08:51:37 +0100 List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: Tool to compare directories and delete duplicate files from one directory Content-Language: en-US To: Paul Procacci Cc: freebsd-questions@freebsd.org References: <9887a438-95e7-87cc-a162-4ad7a70d744f@optiplex-networks.com> <344b29c6-3d69-543d-678d-c2433dbf7152@optiplex-networks.com> <7747f587-f33e-f39c-ac97-fe4fe19e0b76@optiplex-networks.com> From: Kaya Saman In-Reply-To: X-Rspamd-Queue-Id: 4QCNDX73wPz4Lcm X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6871, ipnet:212.159.64.0/18, country:GB] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N This is a multi-part message in MIME format. --------------SiM7Cf9U9LS10HeJGopQNN7n Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Paul, that's fantastic!! Thank you so much! It works!! Now to test on the live system... guess I should take a zfs snapshot=20 before messing around with things :-) I really appreciate this :-D Best regards, Kaya On 5/5/23 08:01, Paul Procacci wrote: > > > > On Fri, May 5, 2023 at 12:06=E2=80=AFAM Kaya Saman=20 > wrote: > > > On 5/5/23 04:36, Paul Procacci wrote: > > #!/usr/bin/env perl > > > > use strict; > > use warnings; > > > > sub msgDie > > { > > =C2=A0 my ($ret) =3D shift; > > =C2=A0 my ($msg) =3D shift // "$0 dir_base dir\n"; > > =C2=A0 print $msg; > > =C2=A0 exit($ret); > > } > > > > msgDie(1) unless(scalar @ARGV eq 2); > > > > my $base =3D $ARGV[0]; > > my $dir =C2=A0=3D $ARGV[1]; > > > > msgDie(1, "base directory doesn't exist\n") unless -d $base; > > msgDie(1, "source directory doesn't exist\n") unless -d $dir; > > > > opendir(my $dh, $dir) or msgDie("Unable to open directory: $dir\n= "); > > while(readdir $dh) > > { > > =C2=A0 next if($_ eq '.' || $_ eq '..'); > > =C2=A0 next if(! -f "$base/$_"); > > > > =C2=A0 my ($ref) =3D (stat("$base/$_"))[7]; > > =C2=A0 my ($src) =3D (stat("$dir/$_"))[7]; > > =C2=A0 unlink("$dir/$_") if($ref =3D=3D $src); > > } > > > To start with this is the directory structure: > > > =C2=A0=C2=A0ls -lhR /tmp/test1 > total 1 > drwxr-xr-x=C2=A0 2 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0 3B May=C2= =A0 5 04:57 dupdir1 > drwxr-xr-x=C2=A0 2 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0 3B May=C2= =A0 5 04:57 dupdir2 > > /tmp/test1/dupdir1: > total 1 > -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0 8B Apr = 30 03:17 dup > > /tmp/test1/dupdir2: > total 1 > -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0 7B May=C2= =A0 5 03:23 dup1 > > > ls -lhR /tmp/test2 > total 1 > drwxr-xr-x=C2=A0 2 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0 3B May=C2= =A0 5 04:56 dupdir1 > drwxr-xr-x=C2=A0 2 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0 3B May=C2= =A0 5 04:56 dupdir2 > > /tmp/test2/dupdir1: > total 1 > -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0 4B Apr = 30 02:53 dup > > /tmp/test2/dupdir2: > total 1 > -rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0 7B Apr = 30 02:47 dup1 > > > So what I want to happen is the script to recurse from the top leve= l > directories test1 and test2 then expected behavior should be to > remove > file dup1 as dup is different between directories. > > > I ran the script and again it didn't produce any output? > > ./test.pl /tmp/test1 /tmp/test2 > > > I'm not sure if I need any other perl module? It is installed: > > p5-ExtUtils-Config-0.008_1=C2=A0=C2=A0=C2=A0=C2=A0 Wrapper for perl= configuration > perl5-5.32.1_3=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Practical Extraction and Repor= t > Language > > > I have many p5- modules too installed but maybe I don't have the > right > ones to run the script? > > > > > - My script doesn't have any output. > - My script doesn't recurse directories. > - My script requires no modules. > - You just need perl5 installed. > > So you want something like this: > > % find test* -type f -ls > 131318 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rwxr-xr-x =C2=A0 =C2=A01 pprocacci= =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=20 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 763 May =C2=A05 06:58 test.pl= > 132503 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01 pprocacci= =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=20 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 5 May =C2=A05 06:52 te= st1/dupdir2/dup1 > 132898 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01 pprocacci= =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=20 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8 May =C2=A05 06:51 te= st1/dupdir1/dup > 132771 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01 pprocacci= =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=20 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 4 May =C2=A05 06:52 te= st2/dupdir1/dup > 133006 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01 pprocacci= =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=20 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 5 May =C2=A05 06:52 te= st2/dupdir2/dup1 > > And after the run of the perl script like so: > % ./test.pl test1 test2 > > You want it to be like this: > > % find test* -type f -ls > 131318 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rwxr-xr-x =C2=A0 =C2=A01 pprocacci= =C2=A0 =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=20 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 763 May =C2=A05 06:58 = test.pl > 132503 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01 pprocacci= =C2=A0 =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=20 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 5 May =C2=A05 0= 6:52 test1/dupdir2/dup1 > 132898 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01 pprocacci= =C2=A0 =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=20 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8 May =C2=A05 0= 6:51 test1/dupdir1/dup > 132771 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01 pprocacci= =C2=A0 =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0=20 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 4 May =C2=A05 0= 6:52 test2/dupdir1/dup > > If so: > > #################################################### > #!/usr/bin/env perl > > use strict; > use warnings; > > sub msgDie > { > =C2=A0 my ($ret) =3D shift; > =C2=A0 my ($msg) =3D shift // "$0 dir_base dir\n"; > =C2=A0 print $msg; > =C2=A0 exit($ret); > } > > sub doit > { > =C2=A0 my($base, $cur) =3D @_; > > =C2=A0 opendir(my $dh, $cur) or msgDie("Unable to open directory: $cur\= n"); > =C2=A0 while(readdir $dh) > =C2=A0 { > =C2=A0 =C2=A0 next if($_ eq '.' || $_ eq '..'); > =C2=A0 =C2=A0 if(-d "$cur/$_"){ doit("$base/$_", "$cur/$_"); next; } > =C2=A0 =C2=A0 next if(! -f "$base/$_"); > > =C2=A0 =C2=A0 my ($ref) =3D (stat("$base/$_"))[7]; > =C2=A0 =C2=A0 my ($src) =3D (stat("$cur/$_"))[7]; > =C2=A0 =C2=A0 unlink("$cur/$_") if($ref =3D=3D $src); > =C2=A0 } > } > > msgDie(1) unless(scalar @ARGV eq 2); > > my $base =3D $ARGV[0]; > my $dir =C2=A0=3D $ARGV[1]; > > msgDie(1, "base diretory doesn't exist\n") unless -d $base; > msgDie(1, "source diretory doesn't exist\n") unless -d $dir; > > doit($base, $dir); > #################################################### > > ~Paul > > --=20 > __________________ > > :(){ :|:& };: --------------SiM7Cf9U9LS10HeJGopQNN7n Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Paul, that's fantastic!! Thank you so much!

It works!!


Now to test on the live system... guess I should take a zfs snapshot before messing around with things :-)


I really appreciate this :-D


Best regards,


Kaya


On 5/5/23 08:01, Paul Procacci wrote:<= br>



On Fri, May 5, 2023 at 12:06=E2=80=AFAM Kaya Saman <= kayasaman@optiplex-networks.com> wrote:

On 5/5/23 04:36, Paul Procacci wrote:
> #!/usr/bin/env perl
>
> use strict;
> use warnings;
>
> sub msgDie
> {
> =C2=A0 my ($ret) =3D shift;
> =C2=A0 my ($msg) =3D shift // "$0 dir_base dir\n";
> =C2=A0 print $msg;
> =C2=A0 exit($ret);
> }
>
> msgDie(1) unless(scalar @ARGV eq 2);
>
> my $base =3D $ARGV[0];
> my $dir =C2=A0=3D $ARGV[1];
>
> msgDie(1, "base directory doesn't exist\n") unless -d $base;
> msgDie(1, "source directory doesn't exist\n") unless -d $dir;
>
> opendir(my $dh, $dir) or msgDie("Unable to open directory: $dir\n");
> while(readdir $dh)
> {
> =C2=A0 next if($_ eq '.' || $_ eq '..');
> =C2=A0 next if(! -f "$base/$_");
>
> =C2=A0 my ($ref) =3D (stat("$base/$_"))[7];
> =C2=A0 my ($src) =3D (stat("$dir/$_"))[7];
> =C2=A0 unlink("$dir/$_") if($ref =3D=3D $src);
> }


To start with this is the directory structure:


=C2=A0=C2=A0ls -lhR /tmp/test1
total 1
drwxr-xr-x=C2=A0 2 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0= 3B May=C2=A0 5 04:57 dupdir1
drwxr-xr-x=C2=A0 2 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0= 3B May=C2=A0 5 04:57 dupdir2

/tmp/test1/dupdir1:
total 1
-rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0= 8B Apr 30 03:17 dup

/tmp/test1/dupdir2:
total 1
-rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0= 7B May=C2=A0 5 03:23 dup1


ls -lhR /tmp/test2
total 1
drwxr-xr-x=C2=A0 2 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0= 3B May=C2=A0 5 04:56 dupdir1
drwxr-xr-x=C2=A0 2 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0= 3B May=C2=A0 5 04:56 dupdir2

/tmp/test2/dupdir1:
total 1
-rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0= 4B Apr 30 02:53 dup

/tmp/test2/dupdir2:
total 1
-rw-r--r--=C2=A0 1 root=C2=A0 wheel=C2=A0=C2=A0=C2=A0=C2=A0= 7B Apr 30 02:47 dup1


So what I want to happen is the script to recurse from the top level
directories test1 and test2 then expected behavior should be to remove
file dup1 as dup is different between directories.


I ran the script and again it didn't produce any output?
./test.pl /tmp/test1 /tmp/test2


I'm not sure if I need any other perl module? It is installed:

p5-ExtUtils-Config-0.008_1=C2=A0=C2=A0=C2=A0=C2=A0 Wrapper = for perl configuration
perl5-5.32.1_3=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Practical Extraction = and Report Language


I have many p5- modules too installed but maybe I don't have the right
ones to run the script?




- My script doesn't have any output.
- My script doesn't recurse directories.
- My script requires no modules.
- You just need perl5 installed.

So you want something like this:

% find test* -type f -ls
131318 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rwxr-xr-x =C2=A0 =C2=A01 p= procacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 763 May =C2=A05 = 06:58 test.pl<= br> 132503 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01 p= procacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 5 May =C2= =A05 06:52 test1/dupdir2/dup1
132898 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01 p= procacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8 May =C2= =A05 06:51 test1/dupdir1/dup
132771 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01 p= procacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 4 May =C2= =A05 06:52 test2/dupdir1/dup
133006 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01 p= procacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 5 May =C2= =A05 06:52 test2/dupdir2/dup1

And after the run of the perl script like so:
% ./test.= pl test1 test2

You want it to be like this:

% find test* -type f -ls
131318 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rwxr-xr-x =C2=A0 =C2=A01= pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 763 Ma= y =C2=A05 06:58 test.pl
132503 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01= pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 5 May =C2=A05 06:52 test1/dupdir2/dup1
132898 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01= pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 8 May =C2=A05 06:51 test1/dupdir1/dup
132771 =C2=A0 =C2=A0 =C2=A0 =C2=A09 -rw-r--r-- =C2=A0 =C2=A01= pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pprocacci =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= 4 May =C2=A05 06:52 test2/dupdir1/dup

If so:

####################################################
#!/usr/bin/env perl

use strict;
use warnings;

sub msgDie
{
=C2=A0 my ($ret) =3D shift;
=C2=A0 my ($msg) =3D shift // "$0 dir_base dir\n";
=C2=A0 print $msg;
=C2=A0 exit($ret);
}

sub doit
{
=C2=A0 my($base, $cur) =3D @_;

=C2=A0 opendir(my $dh, $cur) or msgDie("Unable to open direct= ory: $cur\n");
=C2=A0 while(readdir $dh)
=C2=A0 {
=C2=A0 =C2=A0 next if($_ eq '.' || $_ eq '..');
=C2=A0 =C2=A0 if(-d "$cur/$_"){ doit("$base/$_", "$cur/$_"); = next; }
=C2=A0 =C2=A0 next if(! -f "$base/$_");

=C2=A0 =C2=A0 my ($ref) =3D (stat("$base/$_"))[7];
=C2=A0 =C2=A0 my ($src) =3D (stat("$cur/$_"))[7];
=C2=A0 =C2=A0 unlink("$cur/$_") if($ref =3D=3D $src);
=C2=A0 }
}

msgDie(1) unless(scalar @ARGV eq 2);

my $base =3D $ARGV[0];
my $dir =C2=A0=3D $ARGV[1];

msgDie(1, "base diretory doesn't exist\n") unless -d $base; msgDie(1, "source diretory doesn't exist\n") unless -d $dir;<= br>
doit($base, $dir);
####################################################

~Paul

--
__________________=

:(){ :|:& };:
--------------SiM7Cf9U9LS10HeJGopQNN7n--