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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:27:11+00:00 2026-06-17T15:27:11+00:00

Okay, so essentially Ilm looking to see if there is a way to create

  • 0

Okay, so essentially Ilm looking to see if there is a way to create folder in another folder on a web server using PHP. So for example I have domain.com/script/testdir so I put a script inside of domain.com/script folder called lets say create_dir.php. Every time I access this webpage I want it to create testfolder and then testfolder1 and then testfolder2 every time I refresh and access that same page inside of the testdir folder so after 10 refreshes on this website I would be able to cd in testdir and see testfolder to testfolder9 meaning 10 different folder. I can’t seem to figure out how to do this. I want to be create files in there eventually but is there a way I can set this up? any help would be appreciate. Ive tried so many things and I give up. If someone can just give me some help or show me the exact code on how to make this work as I’m am absolutely clueless and I give up. I REALLY appreciate the help guys, you all rock. Keep in mind I DON’T want it to create dir1-10 in one but rather each time T access the page so if i did it 10,000,000 times it would create 10,000,000 folders.

Or if there is even a way to set the name of the folder as the current date and time.

  • 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-17T15:27:12+00:00Added an answer on June 17, 2026 at 3:27 pm
    function makeDirFromDate($path)
    {
        $date = date('Y-m-d-H-i-s.u');
    
        if (!mkdir($path . '/' . $date, 0, TRUE))
            return FALSE;
    
        return TRUE
    }
    

    This should allow you to make the folders in the way you want. Just give it the path of /domain.com/script/testdir/ and it will make the sub-directories for you using Year, Month, Day, Hour, Minute, Second & Microseconds. The microseconds is in there just in case you run two tests at the same time, it will not make two folders with the same name (that obviously would not work.) so it’s there to prevent such collisions.

    If you really wanted too, you could also change the date argument so do forward slashes. What this will do is, make sub directories for the date, looking something like this.

    domain.com/script/testdir/2013/01/22/20/15/30/9876543

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

Sidebar

Related Questions

I'm thinking of switching from using PHP to Python for web applications, but I
Okay so I am creating a web app thats essentially a workout journal. I
Okay, I have the following create action #posts_controller, nested resource under discussions def create
Okay, so I have my post.php page. If you are not logged in, you'll
Okay, so I'm working on a java server for an Apps backend, it must
Okay, this is a bit messy: I'm using Netbeans, and I have a main
Okay, so, I'm using Thinktecture IdentityModel 4.0 (tt.idm) to accept incoming SAML2 security tokens
Okay, essentially this is what the script looks like: echo -n Guess my number:
Okay so right now I have essentially this code: class a { public void
Okay, the title is not saying too much, sorry. Essentially it's an Architecture Question

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.