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.

Link to comment
Share on other sites

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";
      }
    }
  }

?>

Link to comment
Share on other sites

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);

 

?>

 

 

Link to comment
Share on other sites

<?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";
}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.