Jump to content

Is there a php function that can create folders in windows os


madspof

Recommended Posts

chdir — Change directory

chroot — Change the root directory

dir — Directory class

closedir — Close directory handle

getcwd — Gets the current working directory

opendir — Open directory handle

readdir — Read entry from directory handle

rewinddir — Rewind directory handle

scandir — List files and directories inside the specified path

 

And then you can use in_array on your error.

okay let me try one more time is there some kind of function that can scan a directory and jsut show the folders in the directory

 

Sometimes you actually need to write some code.

 

<?php

  function show_dirs($path) {
    $dir = scandir($path);
    foreach ($dir as $node) {
      if (is_dir($path.'/'.$node)) {
        echo $node."\n";
      }
    }
  }

?>

is it possible for me to put a variable into the mkdir function for example

the main reason is that I want this script is so that the path name created can be a username from a login.

<?php

$varaible = 'hi';

 

mkdir("/path/'$variable'", 0700);

 

?>

 

 

<?php

$dir_path="pic/";

$dir_name = "cooker";

if(is_dir("$dir_path$dir_name")){

rmdir("$dir_path$dir_name");	
}

mkdir("$dir_path$dir_name", 0777);

if(is_dir("$dir_path$dir_name")){

echo " Dir created $dir_name";

}else{

echo " no directory of $dir_name created";
}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.