Hello and welcome to our community! Is this your first visit?
Register
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
    Posts
    138
    Thanks
    3
    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.03.27.23.45.12 - 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.

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

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,802
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    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
    •