Re: Linux Directory Copy Modules that Won't
Jesus Lozano Mosterin <[email protected]> Sat, 1 Feb 2025 16:56:34 +0100
| Newsgroups | gmane.comp.lang.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) <<a href=3D"mailto:rhelms@rhe= ynmail.de">[email protected]</a>> 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> > This is perl 5, version 36, subversion 0 (v5.36.0) built for x86_64-li= nux-gnu-thread-multi<br> > (with 53 registered patches, see perl -V for more detail)<br> ><br> > Copyright 1987-2022, Larry Wall<br> ><br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0The issue here is trying to copy directories= of files<br> > from the main SSD drive to various thumb drivesthat must be<br> > mounted on the system for the copy to occur.<br> ><br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0The program flawlessly did every single thin= g I told it to<br> > so there are up to 4 directories, each with a mounted thumb drive<br> > sitting there waiting on pins and needles for the gush of<br> > anticipated data but the only way I've gotten this to work in the<= br> > past is to cheat by using the system command and standard=C2=A0 unix<b= r> > copying commands as in:<br> ><br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 system(&= quot;cp -p -r \"$docname\" \"/$guides[1]\"/");<br> ><br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0The way this program was supposed to copy a = disk folder<br> > to a corresponding thumb drive is written:<br> ><br> >=C2=A0 =C2=A0 =C2=A0dircopy ("\"weekly\", \"/weekly= /\"") or die!$;<br> ><br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0It always dies at the copy command and it is= nothing to<br> > do with permissions as I can sit here and execute a command from<br> > the shell like:<br> ><br> > date >/weekly or whatever the mounted drive is called and the comma= nd<br> > succeeds normally.<br> ><br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0Here is the first part of the program which = is 137 lines<br> > long and nothing else is failing except for the directory copies:<br> ><br> > #!/usr/bin/perl -w<br> > use strict;<br> > use warnings::unused;<br> > use IO::Handle;<br> > use File::HomeDir;<br> > use Cwd qw(getcwd);<br> ><br> > #use File::Copy "cp";<br> > use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove);= <br> > use File::Find;<br> > use File::Spec;<br> ><br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0I suspect several of those modules aren'= t needed but the<br> > program does exactly what I need it to do until the copy occurs.<br> > The directories are their and populated with other directories<br> > which should all be copied to selected thumb drives as whole<br> > directories and running in debug mode as in perl -d shows thit to<br> > be true so the only issue to solve is that dircopy command.=C2=A0 You<= br> > will notice another File::Copy module commented out that is<br> > supposed to take cp commands but didn't either.=C2=A0 It boils dow= n to<br> > none of these copy modules appear to be working in this case.<br> ><br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0The actual copy command I am using is:<br> ><br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dircopy(" $dir , /$dir") o= r die !$;<br> > $dir in this case is the directory name which could be one of 4<br> > possible names but it doesn't matter because there has not been<br= > > one bit copied using either of the two modules I tried and the<br> > dircopy module does exactly what one needs in this particular<br> > case but silently fails 100% of the time.<br> ><br> > Thanks for any good ideas since this appears to be quite useful<br> > but hasn't shown that side of it's behavior yet.<br> ><br> > Martin McCormick<br> ><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--