Re: Linux Directory Copy Modules that Won't
[email protected] (Jim Gibson via beginners) Sat, 1 Feb 2025 07:54:18 -0800
| Newsgroups | perl.beginners |
|---|---|
| Message-ID | <[email protected]> |
> On Feb 1, 2025, at 6:34=E2=80=AFAM, Martin McCormick = <[email protected]> wrote: >=20 > 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) >=20 > Copyright 1987-2022, Larry Wall >=20 > 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. >=20 > 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: >=20 > system("cp -p -r \"$docname\" \"/$guides[1]\"/"); >=20 > The way this program was supposed to copy a disk folder > to a corresponding thumb drive is written: >=20 > dircopy ("\"weekly\", \"/weekly/\"") or die!$; That should be=20 dircopy( ("\"weekly\=E2=80=9D", "\"/weekly/\"" ); It looks like you are giving dircopy only one argument: "\"weekly\", = \"/weekly/\=E2=80=9D=E2=80=9D. The profile for dircopy is: dircopy( $orig, $new, [$buf] ); To debug the probem further, write a short-as-possible program that = copies a directory. Something like: use strict; use File::Copy::Recursive qw(dircopy); my $orig =3D =E2=80=9C=E2=80=A6=E2=80=9D; my $new =3D =E2=80=9C=E2=80=A6=E2=80=9D; dircopy( $orig, $new ); and see what happens. An easier way to generate a string with embedded quote signs is to use = the q (single quote) or qq (double quotes) functions: my $double_quotes =3D qq("weekly", "/weekly/=E2=80=9D); Jim Gibson [email protected]