Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7851013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:03:51+00:00 2026-06-02T19:03:51+00:00

mkdir (dir1/{dir1-1,dir1-2},0755,TRUE); This command creates the folder dir1 with a single subfolder called ‘{dir1-1,dir1-2}’

  • 0
mkdir ("dir1/{dir1-1,dir1-2}",0755,TRUE);

This command creates the folder dir1 with a single subfolder called ‘{dir1-1,dir1-2}’ instead of creating dir1-1 and dir1-2 as two subfolders for dir1.

Any idea how to get this to work from a single mkdir command as above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:03:52+00:00Added an answer on June 2, 2026 at 7:03 pm

    PHP does not support brace expansion in the same way as the shell does. If you want to create multiple directories, you will have to call mkdir() multiple times, and you can easily do this by looping.

    You can pass TRUE as the third argument to mkdir() – this means that all directories back up the tree will also be created if they do not exist and the parent is writable. You can safely pass TRUE to all calls when operating in a loop, the first iteration for a given directory will create it, subsequent calls will have no adverse effect.

    For example:

    $toCreate = array(
      'dir1/dir1-1',
      'dir1/dir1-2'
    );
    
    $permissions = 0755;
    
    foreach ($toCreate as $dir) {
      mkdir($dir, $permissions, TRUE);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trying to create some dirs like this: @mkdir(photos/$cat/$sku, 0777, true) it creates the
Why I can't do something like this? mkdir folder/subfolder/ in order to achive this
Any ideas of why mkdir is returning true but it's not creating any folder?
In Linux, mkdir -p creates a folder tree. What is the equivalent option in
mkdir() is working correctly this question is more about catching an error. Instead of
Possible Duplicate: PHP code mkdir('images','0777') creates a folder with 411 permissions! Why? I am
In my code I have a line similar to this: rval = subprocess.call([mkdir,directoryName], shell=True)
I cannot delete folder created by php mkdir for I in `echo $*` do
How would you accomplish this? mkdir newbuild cd newbuild git init git remote add
Why do I get this in MSYS? user@lappy1 ~ $ mkdir test sh: mkdir:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.