checkAndCreateDirectory();
moveFiles();
sub checkAndCreateDirectory {
my $dirname = "launchpad/config/com/adobe/granite/auth/saml/SamlAuthenticationHandler";
my @folders = split /\/|\\/, $dirname;
map { mkdir $_; chdir $_; } @folders;
}
sub moveFiles {
my $source_dir = "SamlAuthenticationHandler";
my $destination_dir = "launchpad/config/com/adobe/granite/auth/saml/SamlAuthenticationHandler";
opendir(my $DIR, $destination_dir) || die "can't opendir $source_dir: $!";
move("$source_dir", "$destination_dir") or die "FAIL : Unable to add config -> $!";
}
checkAndCreateDirectory() and moveFiles() subroutines are running fine with sepaerate script but when tried to run in same script it throws error : No such file or directory
Can anyone please help me in figuring out the issue? Is there any issue with
map { mkdir $; chdir $; } @folders;
?
$!:mkdir $_ or die "Could not create folder '$_': $!"make_pathin File::Path it will create all the nonexistent directories in one callmapin a void context is a sign you probably should have been usingforinstead.