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 8020451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:41:48+00:00 2026-06-04T21:41:48+00:00

In my books folder , there are nearly 200 book folder like : –books

  • 0

In my books folder , there are nearly 200 book folder like :

--books (folder)  
  |--book1(folder)
  |--book2(folder)
  |--(this continues until 200)  

What I want is that I need to create some directories inside 200 folder by fetching data from mysql about folder. I can make it manually but making one by one is very inefficient.

I coded create_folder.php and insert it book1 folder to see how it give a result :

$current_folder = basename(dirname(__FILE__));

// I choose which directories are inserted.
$sql = "SELECT directory FROM ..............WHERE folder = {$current_folder} ";

$result = mysql_query($sql);

while ($row = mysql_fetch_array($result)) {
  mkdir($row['directory']);
}  

So, in my book1 folder, I created directories via database.
After that, I created glob.php file in order to insert create_folder.php in all 200 directories automaticly.(I put glob.php in main books folder. Here :

$content = file_get_contents("create_folder.php");

$files = glob( './*' );
foreach( $files as $file ) {
if( is_dir( $file ) && is_writable( $file ) ) {
    file_put_contents( $file . '/create_folder.php', $content );
    }
}

Now, inside 200 folders, there is create_folder.php. The problem is, I must make create_folder.php run in all 200 directories in order to create sub directories. Any quick way to run it? Thanks…

  • 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-04T21:41:50+00:00Added an answer on June 4, 2026 at 9:41 pm
    $files = glob( './*' );
    foreach( $files as $file ) {
    if( is_dir( $file ) && is_writable( $file ) ) {
    $output = exec('php -l '.$file.'/create_folder.php',$function_output,$return);
    print $output."\n";
    print $return."\n";
    var_dump($function_output);
        }
    }
    

    Run this in your root directory. SO if your sites are in /home/user/site1, /home/user/site2, then run it from /home/user.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created an address book as described here and that works like a charm.
I read from some books that Phusion Passenger is the answer to easy Ruby
Are there any good books on the subject worth reading and still up-to-date with
I'm studying this book (Addison Wesley Windows System Programming 4th Edition) and I think
Is there any way to use Dropbox to sync selected local files? I like
I notice that the official recommended book The Definitive Guide to Django was written
I am making one website about books and the user reaches the book which
Is there a practical "crash" guide for writing ActionScript 3. There's migration books from
I am creating an app that allows users to import books from the books
I have a booking system that i'm trying to set up. I want to

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.