in reply to Convert KMail emails to Claws

Is this simply because the file is attempted to be copied before the path exists ? How do I fix that please

That could very well be.

use File::Basename; use File::Path; ... my $nfile = ''; ... if (-e "$file" && $nfile ne "") { my $dir = dirname $nfile; if( !-d $dir ) { make_path($dir) or die "Can't create $dir: $!\n"; } $DEBUG && print qq{\n+++ cp "$file" "$nfile"}; $PRETEND || system("cp \"$file\" \"$nfile\""); $count++; }

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^2: Convert KMail emails to Claws
by peterr (Scribe) on Apr 28, 2017 at 04:19 UTC

    Thanks. I included both the 'Use' statements, and that code, however the error was "Undefined subroutine &main::make_path"

    Possibly the 'Use' needs to be defined globally or I put the 'Use' with the sub routine ?

      Replace use File::Path; with use File::Path qw(make_path);, it is not exported by default.