Hi all

I am using Windows XP with LAMP setup and have been using the mkdir function to create folders on my hard disk, however, I cannot delete the folders now either by PHP or Windows Explorer and would like to know:

a) Why this is
b) How to delete them
c) How to prevent it from happening in the future

My Code that creates the folder is just this:

mkdir($path . "/" . $location . "/" . $foldername, 0777);

According to php.net the 'mode' part of the mkdir function is not applied with Windows.

Can someone explain what has happened?

Thanks
Doug

    hi!

    I use Windoes XP.
    To change the permission of a folder
    you just 'right click' the folder name.
    At the bottom of drop-down menu you have 'Properties'.
    You can unmark the attribute 'Read-only'
    and click 'Apply'
    See this image:
    http://www.febooti.com/images/tutorials/properties-general.gif
    And here is the tutorial page:
    http://www.febooti.com/products/filetweak/tutorials/tutorial-changing-file-attributes.html

    <?php
    
    // make the folder 'ccc' inside directory '/aaa/bbb'
    $new = 'ccc';
    // directory /aaa/bbb' must exist and be writable
    $path = '/aaa/bbb';
    
    if( !is_dir($path) )
        exit( 'no such dir, where can make dir' );
    if ( !mkdir($path. '/' .$new) )
        exit( 'could not make dir - check directory permissions' );
    
    echo 'dir was made<br>';
    // ============================
    
    // remove the folder 'ccc' inside directory '/aaa/bbb'
    $del = 'ccc';
    // directory /aaa/bbb' must exist and be writable
    $path = '/aaa/bbb';
    
    if( !is_dir($path. '/' .$del) )
        exit( 'no such dir to remove' );
    // remove folder, must be empty and action be permitted
    if( !rmdir($path. '/' .$del) )
        exit( 'could not remove dir, check dir is empty and permissions' );
    
    echo 'dir was removed<br>';
    exit( 'end script' );
    
    ?>
      Write a Reply...