Results 1 to 4 of 4

Thread: Create Folders

  1. #1
    Join Date
    Nov 2008
    Posts
    866

    Create Folders

    I use the mkdir command to create a folder. Sometimes this file already exists. PHP displays an error message (despite my order to apply successfully)

    How to use this function (or another) by forcing in the case of existing file without erasing the content and display an error message?

  2. #2
    Join Date
    May 2008
    Posts
    271

    Re: Create Folders

    Use is_dir () first. You can make a function, type:
    Code:
      function alx_mkdir ($ newdir) {
      if (! is_dir ($ newdir)) {
      mkdir ($ newdir); 
      }
      }
    You can also use the @ operator, which turns warnings

  3. #3
    Join Date
    Nov 2008
    Posts
    866

    Re: Create Folders

    The code returns me an error in line 3:
    Code:
    if (! is_dir ("../ new_dir ")) {
    if (! mkdir ("../ new_dir ")) 
    }
    }
    which returns me this error:

    Parse error: syntax error, unexpected T_STRING in ... on line 2

  4. #4
    Join Date
    May 2008
    Posts
    271

    Re: Create Folders

    Get a little look. This is not a programming problem, but syntax. It is missing a parenthesis.

Similar Threads

  1. How to create folders to store emails in Windows 8
    By Gorochana in forum Operating Systems
    Replies: 4
    Last Post: 17-07-2013, 11:11 AM
  2. How to create folders & sub folders from a Excel list
    By The-Farmer in forum MS Office Support
    Replies: 2
    Last Post: 15-02-2012, 04:54 PM
  3. Replies: 3
    Last Post: 11-01-2012, 07:25 AM
  4. Can create folders but cannot rename them
    By Jhonwho in forum Operating Systems
    Replies: 4
    Last Post: 28-04-2009, 11:33 AM
  5. Create and use virtual folders in Windows Vista
    By Jackie in forum Customize Desktop
    Replies: 1
    Last Post: 27-12-2008, 08:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,573,206.13203 seconds with 17 queries