$dir = 'c:/mike/tmp oops space/';
unless(-d $dir){
mkdir $dir or die "Couldn't create dir: [$dir] ($!)";
}
I ran above script..and got this error msg.
C:\PerlScripts>test.pl
Couldn't create dir: [c:/mike/
\PerlScripts\test.pl line 4.
I followed kodaff's code to replace the spaces...
I tried Mike's code..the problem arise when I need to create a folder with space in the folder name
$dir = 'c:/mike/tmp oops space/';
unless(-d $dir){
mkdir $dir or die;
}
This will die.
$path = "folder1\folder2\folder3";
if (system($createdir)) { print "mkdir failed\n"; };
I want to check if this directory exists before creating it. $cpath is a relative path. I want to create it only if it doesn't exist. I'm using Windows..can anyone help me?
I tried -d and -e, it doesn't...
Awesome..this works great!!
So incredible sometimes to see how just 3 lines of codes in perl can do so much...I've heard great things about perl..but never really used it much at work, should kick myself for not learning..
Thank you so much aabiir!!
I want to form a path name so that I know where to save the file.
For example, this is taken from a sample XML file.
I want to take the words between each pair of single quotes, and concatenate and form a path.
So the output should be firstlevel\secondlevel\thirdlevel\filename
Can someone...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.