0

Hi I trying to create a script for creating a simple folder and subfolder. So basically i am in directory \home\ and want to create folder1, and afterwards subfolder 'folder2'.
so at the end, I am expecting to have a simple \home\folder1\folder2.
This is what I did

#!/usr/bin/perl -w
use File:: Path #i have to put a space between file and path, because if not there will be an emoticon shown on this post :)

#I have only the directory of \home\ and wants to have \folder1 and \folder2
my $path1 = '\home\folder1';
my $path2 = 'folder2' ;

make_path($path1,$path2);

and this error that I get
"\home\folder1" is not exported by the File:: Path module
Can't continueafter import errors at tes.pl line 4

thank you for the guidance

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by reza.adinata
1
use File::Path;
my $path1 = '/home/folder1';
my $path2 = 'folder2' ;

mkpath "$path1";
mkpath "$path1/$path2";
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.