Sifmole has asked for the wisdom of the Perl Monks concerning the following question:
I know TMTOWTDI, but what would be considered the more perlish way to copy a whole directory of files?
Thanks in advance, Sifmole# This is not portable, right? system('cp', 'source_dir/*', 'dest_dir/'); # Is there was to do this without a loop/map? use File::Copy; opendir(INDIR, 'source_dir'); for my $file (readdir(<INDIR>)) { copy("source_dir/$file", "dest_dir/$file"); } # And of course there is always... (ick..) `cp source_dir/* dest_dir/*`;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perlish way of copying files
by stefan k (Curate) on May 03, 2001 at 18:29 UTC | |
by Sifmole (Chaplain) on May 03, 2001 at 18:33 UTC | |
|
(tye)Re: Perlish way of copying files
by tye (Sage) on May 03, 2001 at 18:59 UTC | |
by Sifmole (Chaplain) on May 03, 2001 at 19:06 UTC | |
by Ovid (Cardinal) on May 03, 2001 at 19:49 UTC | |
by Sifmole (Chaplain) on May 03, 2001 at 21:02 UTC |