1. Perl
  2. File operation
  3. here

Create a multi - level directory

To create a multi-level directory, use the mkpath function of File::Path module.

use File::Path 'mkpath';
mkpath $dir_multi_level;

To create a multi-level directory, use the mkpath function of the File::Path module.

Example

This is an example to create a multi-level directory.

use strict;
use warnings;
use File::Path 'mkpath';

# Create a multi-level directory.
my $dir_multi_level = "dir_20080524_ $$/ dir1";

print "1: Create a multi-level directory.\n";
mkpath($dir_multi_level);

Related Informatrion