Uncategorized

Making nested directory in Perl

Simple and quicky.

#!/usr/bin/env perl
use strict;
use warnings;

use File::Path qw(make_path);

make_path('my/nested/directory'); # same like Unix mkdir -p

# or set the directory permission directly

make_path('my/nested/directory2', {
    chmod => 0755
});

# one liner

perl -MFile::Path=make_path -e 'make_path("animals/flamingo");'

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s