Groups | Search | Server Info | Login | Register
Groups > perl.beginners > #19374
| Newsgroups | perl.beginners |
|---|---|
| Message-ID | <2864d55e-6efb-484a-98b4-7f2db3eeea05@rheynmail.de> (permalink) |
| Date | 2025-02-01 16:42 +0100 |
| Subject | Re: Linux Directory Copy Modules that Won't |
| References | <E1teEZs-0013iD-1p@wb5agz> |
| From | rhelms@rheynmail.de ("Ruprecht Helms (privat)") |
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
>
Back to perl.beginners | Previous | Next | Find similar
Re: Linux Directory Copy Modules that Won't rhelms@rheynmail.de ("Ruprecht Helms (privat)") - 2025-02-01 16:42 +0100
csiph-web