Re: Linux Directory Copy Modules that Won't

[email protected] (Jesus Lozano Mosterin) Sat, 1 Feb 2025 16:56:34 +0100
Newsgroups perl.beginners
Message-ID <CAM+ju678j5PXtDioYif_E2=LfvaKTkcZPRPVeqCae5-skRcFPg@mail.gmail.com>
--000000000000b7b1bb062d16b493
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi there. Another nix way is to use
=E2=80=98rsync=E2=80=99 with any =E2=80=94exclude you want

To put in a .sh file plus cron is the
lazy way of Life.

Cheers.

El El s=C3=A1b, 1 feb 2025 a las 16:43, Ruprecht Helms (privat) <
[email protected]> escribi=C3=B3:

> Hi,
>
> I do my backups to the nas by a short bash-script using the wput-command.
> That is combined with a cronjob that does ist every hour.
>
> Its not the perl-way but a seamilar.
>
> Regards,
> Ruprecht
>
> On 01.02.25 15:34, Martin McCormick wrote:
> > This is perl 5, version 36, subversion 0 (v5.36.0) built for
> x86_64-linux-gnu-thread-multi
> > (with 53 registered patches, see perl -V for more detail)
> >
> > Copyright 1987-2022, Larry Wall
> >
> >       The issue here is trying to copy directories of files
> > from the main SSD drive to various thumb drivesthat must be
> > mounted on the system for the copy to occur.
> >
> >       The program flawlessly did every single thing I told it to
> > so there are up to 4 directories, each with a mounted thumb drive
> > sitting there waiting on pins and needles for the gush of
> > anticipated data but the only way I've gotten this to work in the
> > past is to cheat by using the system command and standard  unix
> > copying commands as in:
> >
> >                  system("cp -p -r \"$docname\" \"/$guides[1]\"/");
> >
> >       The way this program was supposed to copy a disk folder
> > to a corresponding thumb drive is written:
> >
> >     dircopy ("\"weekly\", \"/weekly/\"") or die!$;
> >
> >       It always dies at the copy command and it is nothing to
> > do with permissions as I can sit here and execute a command from
> > the shell like:
> >
> > date >/weekly or whatever the mounted drive is called and the command
> > succeeds normally.
> >
> >       Here is the first part of the program which is 137 lines
> > long and nothing else is failing except for the directory copies:
> >
> > #!/usr/bin/perl -w
> > use strict;
> > use warnings::unused;
> > use IO::Handle;
> > use File::HomeDir;
> > use Cwd qw(getcwd);
> >
> > #use File::Copy "cp";
> > use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove);
> > use File::Find;
> > use File::Spec;
> >
> >       I suspect several of those modules aren't needed but the
> > program does exactly what I need it to do until the copy occurs.
> > The directories are their and populated with other directories
> > which should all be copied to selected thumb drives as whole
> > directories and running in debug mode as in perl -d shows thit to
> > be true so the only issue to solve is that dircopy command.  You
> > will notice another File::Copy module commented out that is
> > supposed to take cp commands but didn't either.  It boils down to
> > none of these copy modules appear to be working in this case.
> >
> >       The actual copy command I am using is:
> >
> >          dircopy(" $dir , /$dir") or die !$;
> > $dir in this case is the directory name which could be one of 4
> > possible names but it doesn't matter because there has not been
> > one bit copied using either of the two modules I tried and the
> > dircopy module does exactly what one needs in this particular
> > case but silently fails 100% of the time.
> >
> > Thanks for any good ideas since this appears to be quite useful
> > but hasn't shown that side of it's behavior yet.
> >
> > Martin McCormick
> >
>
> --
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
>
>
>

--000000000000b7b1bb062d16b493
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><br></div><div dir=3D"auto">Hi there. Another nix way is =
to use</div><div dir=3D"auto">=E2=80=98rsync=E2=80=99 with any =E2=80=94exc=
lude you want</div><div dir=3D"auto"><br></div><div dir=3D"auto">To put in =
a .sh file plus cron is the</div><div dir=3D"auto">lazy way of Life.</div><=
div dir=3D"auto"><br></div><div dir=3D"auto">Cheers.</div><div dir=3D"auto"=
><br></div><div dir=3D"auto"><div class=3D"gmail_quote gmail_quote_containe=
r" dir=3D"auto"><div dir=3D"ltr" class=3D"gmail_attr">El El s=C3=A1b, 1 feb=
 2025 a las 16:43, Ruprecht Helms (privat) &lt;<a href=3D"mailto:rhelms@rhe=
ynmail.de">[email protected]</a>&gt; escribi=C3=B3:<br></div><blockquote =
class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid=
;padding-left:1ex">Hi,<br>
<br>
I do my backups to the nas by a short bash-script using the wput-command.<b=
r>
That is combined with a cronjob that does ist every hour.<br>
<br>
Its not the perl-way but a seamilar.<br>
<br>
Regards,<br>
Ruprecht<br>
<br>
On 01.02.25 15:34, Martin McCormick wrote:<br>
&gt; This is perl 5, version 36, subversion 0 (v5.36.0) built for x86_64-li=
nux-gnu-thread-multi<br>
&gt; (with 53 registered patches, see perl -V for more detail)<br>
&gt;<br>
&gt; Copyright 1987-2022, Larry Wall<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0The issue here is trying to copy directories=
 of files<br>
&gt; from the main SSD drive to various thumb drivesthat must be<br>
&gt; mounted on the system for the copy to occur.<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0The program flawlessly did every single thin=
g I told it to<br>
&gt; so there are up to 4 directories, each with a mounted thumb drive<br>
&gt; sitting there waiting on pins and needles for the gush of<br>
&gt; anticipated data but the only way I&#39;ve gotten this to work in the<=
br>
&gt; past is to cheat by using the system command and standard=C2=A0 unix<b=
r>
&gt; copying commands as in:<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 system(&=
quot;cp -p -r \&quot;$docname\&quot; \&quot;/$guides[1]\&quot;/&quot;);<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0The way this program was supposed to copy a =
disk folder<br>
&gt; to a corresponding thumb drive is written:<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0dircopy (&quot;\&quot;weekly\&quot;, \&quot;/weekly=
/\&quot;&quot;) or die!$;<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0It always dies at the copy command and it is=
 nothing to<br>
&gt; do with permissions as I can sit here and execute a command from<br>
&gt; the shell like:<br>
&gt;<br>
&gt; date &gt;/weekly or whatever the mounted drive is called and the comma=
nd<br>
&gt; succeeds normally.<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0Here is the first part of the program which =
is 137 lines<br>
&gt; long and nothing else is failing except for the directory copies:<br>
&gt;<br>
&gt; #!/usr/bin/perl -w<br>
&gt; use strict;<br>
&gt; use warnings::unused;<br>
&gt; use IO::Handle;<br>
&gt; use File::HomeDir;<br>
&gt; use Cwd qw(getcwd);<br>
&gt;<br>
&gt; #use File::Copy &quot;cp&quot;;<br>
&gt; use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove);=
<br>
&gt; use File::Find;<br>
&gt; use File::Spec;<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0I suspect several of those modules aren&#39;=
t needed but the<br>
&gt; program does exactly what I need it to do until the copy occurs.<br>
&gt; The directories are their and populated with other directories<br>
&gt; which should all be copied to selected thumb drives as whole<br>
&gt; directories and running in debug mode as in perl -d shows thit to<br>
&gt; be true so the only issue to solve is that dircopy command.=C2=A0 You<=
br>
&gt; will notice another File::Copy module commented out that is<br>
&gt; supposed to take cp commands but didn&#39;t either.=C2=A0 It boils dow=
n to<br>
&gt; none of these copy modules appear to be working in this case.<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0The actual copy command I am using is:<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dircopy(&quot; $dir , /$dir&quot;) o=
r die !$;<br>
&gt; $dir in this case is the directory name which could be one of 4<br>
&gt; possible names but it doesn&#39;t matter because there has not been<br=
>
&gt; one bit copied using either of the two modules I tried and the<br>
&gt; dircopy module does exactly what one needs in this particular<br>
&gt; case but silently fails 100% of the time.<br>
&gt;<br>
&gt; Thanks for any good ideas since this appears to be quite useful<br>
&gt; but hasn&#39;t shown that side of it&#39;s behavior yet.<br>
&gt;<br>
&gt; Martin McCormick<br>
&gt;<br>
<br>
-- <br>
To unsubscribe, e-mail: <a href=3D"mailto:[email protected]" t=
arget=3D"_blank">[email protected]</a><br>
For additional commands, e-mail: <a href=3D"mailto:[email protected]"=
 target=3D"_blank">[email protected]</a><br>
<a href=3D"http://learn.perl.org/" rel=3D"noreferrer" target=3D"_blank">htt=
p://learn.perl.org/</a><br>
<br>
<br>
</blockquote></div></div>

--000000000000b7b1bb062d16b493--