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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:57:20+00:00 2026-06-14T00:57:20+00:00

I store backups of databases in a directory structure year/month/day/time/backup_name an example would be

  • 0

I store backups of databases in a directory structure

year/month/day/time/backup_name

an example would be

basics_mini/2012/11/05/012232/RATIONAL.0.db2inst1.NODE0000.20110505004037.001 basics_mini/2012/11/06/012251/RATIONAL.0.db2inst1.NODE0000.20110505003930.001

note that timestamp from the backup file cannot be used. Before the automation testing starts the server time is set to 5.5.2011

So the question is how I can get the latest file if I pass the “base directory” (basics_mini) to some function that I am going to code. My thoughts are that I list the base directory and sort by time to get the year. Then I do the same for month, day and time.

I wonder if there is any “easier” solution to that in php.

  • 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-14T00:57:21+00:00Added an answer on June 14, 2026 at 12:57 am

    Well, you can fetch whole directory tree at once and get last elem from it:

    $baseFolder = './backup_mini' ;
    
    $arr = glob("{$baseFolder}/*/*/*/*", GLOB_ONLYDIR);
    $lastDir = array_pop($arr);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running backups against multiple databases hosted at Rackspace. This is working fine. The
In my app, I store the user's app data using MySQLite databases, and I
I have a directory for database backups, and a PHP script that makes a
I would like to save my backups from my SQL 2008 server to another
I need to backup all MySQL databases available to a partiular user and store
I have a stored procedure that runs custom backups for around 60 SQL servers
I have a backup location, which uses hardlinks to store existing or changed files.
STORE = { item : function() { } }; STORE.item.prototype.add = function() { alert('test
I store some data as XML and the changes of the user as diff
I store some data in a database and I read those data with a

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.