Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2006
    Thanked 0 Times in 0 Posts

    PHP Create Directory by date

    Hello all:

    I am trying to create directory by date. It is something like creating a flat file database. What I am trying to do is to create a new topic. In my root directory I want to create (if the date is 2009. - YYYY.MM.DD.HH.MM.SS) then I want to create a file 2009_03_27_23_45_12.txt in 2009>03>27 directory. Now I can create a file with a php - I do have some experience with PHP but what happens if I try to create another file on the same date. I dont have to create the directories (hierarchy) again - i just need to create the file only after checking if the directories exist. I am looking for the best practice for doing this. I am looking for an example code. Please help.

    Last edited by neo_philiac; 03-28-2009 at 05:05 PM.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Thanked 2,224 Times in 2,211 Posts
    Check the existence of file/directory using file_exists() and do the needful.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts