Hi, i am trying to create a new folder and then enter the new folder. I have tried to do this but have failed on all attempts. any help would be greatly appreciated.
Open new folder and enter it
Collapse
X
-
ANDCode:mkdir Test; use Cwd(); $path = getcwd(); #Get the current path $path =~ s/\\/\//sg; opendir(DIR, $path) || die ("cannot open the path");
but those didn't work. they both can create a directory but they won't enter itCode:mkdir Sample; opendir(DIRHANDLE, "/Sample");
Comment
-
Hi,
Still i didn't understood ur need,
After creating the folder wt do u want to do(that means inside the newfolder)
try the following code
it will create a newfolder with in newfolderCode:use Cwd; $path = getcwd(); #Get the current path $path =~ s/\\/\//sg; print "Enter the directory name\n"; $dir = <STDIN>; mkdir($dir); $new = $path."\/".$dir; opendir(DIR, $new) || die ("cannot open the path"); mkdir("$new/hai");
Please tel wt do u Exactly want
Otherwise it's hard to understand(For me)Comment
-
opendir opens a directory for processing by "readdir", "telldir", "seekdir", "rewinddir" and "closedir". If you want to make a directory, you should use chdir() to change to where you want to create directory, and then use mkdir().Originally posted by bdan44mkdir Test;
use Cwd();
$path=getcwd(); #Get the current path
$path=~s/\\/\//sg;
opendir(DIR, $path) || die ("cannot open the path");
AND
mkdir Sample;
opendir(DIRHAND LE, "/Sample");
but those didn't work. they both can create a directory but they won't enter itComment
Comment