djbiv has asked for the wisdom of the Perl Monks concerning the following question:
here is the output.use strict; use File::Copy; use diagnostics -verbose; my $trailer = qw( \ ); my $dev_dir = 'V:\dblomber\authdev' . $trailer; my $qa_dir = 'V:\dblomber\authqa' . $trailer; my $qa_pre_new_dir = 'V:\dblomber\auth'; my $all_qa_files; #get date yyyymmdd to append to new dir my($sec,$min,$hour,$mday,$mon,$year) = localtime; my $current_date = sprintf("%04d%02d%02d", $year+1900,$mon+1,$mday); my $qa_new_dir = $qa_pre_new_dir . $current_date . $trailer; mkdir $qa_new_dir; print "CREATED NEW ARCHIVE DIR:$qa_new_dir:\n"; opendir (QA, $qa_dir) or die "Cannot open $qa_dir $!"; print "OPENED $qa_dir\n"; opendir (QAN, $qa_new_dir) or die "Cannot open $qa_new_dir $!"; print "OPENED $qa_new_dir\n"; foreach $all_qa_files (sort readdir(QA)) { enable diagnostics; copy ("$qa_dir$all_qa_files", "$qa_new_dir$all_qa_files") or d +ie "copy Failed: $!"; print "COPYING FILE:$qa_dir$all_qa_files\t to $qa_new_dir$all_ +qa_files\n"; disable diagnostics; }
Here is the question.CREATED NEW ARCHIVE DIR:V:\dblomber\auth20060221\: OPENED V:\dblomber\authqa\ OPENED V:\dblomber\auth20060221\ Uncaught exception from user code: copy Failed: at T:\My Documents\perl\release.pl line 37. at T:\My Documents\perl\release.pl line 37
CREATED NEW ARCHIVE DIR:V:\dblomber\auth20060221\: OPENED V:\dblomber\authqa\ OPENED V:\dblomber\auth20060221\ COPYING FILE:V:\dblomber\authqa\. to V:\dblomber\auth20060221\. COPYING FILE:V:\dblomber\authqa\.. to V:\dblomber\auth20060221\. +. COPYING FILE:V:\dblomber\authqa\crap.txt to V:\dblomber\auth20 +060221\crap.txt COPYING FILE:V:\dblomber\authqa\sample.doc to V:\dblomber\auth20 +060221\sample.doc FINISHED COPYING FILES CLOSED V:\dblomber\authqa\
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Yet Another File::Copy problem
by GrandFather (Saint) on Feb 22, 2006 at 01:15 UTC | |
by ikegami (Patriarch) on Feb 22, 2006 at 02:14 UTC | |
by djbiv (Scribe) on Feb 22, 2006 at 01:33 UTC | |
by spiritway (Vicar) on Feb 22, 2006 at 01:57 UTC |