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

  • Home
  • SEARCH
  • 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 4585416
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:29:31+00:00 2026-05-21T21:29:31+00:00

Am having a folder with millions of files in the server File name will

  • 0

Am having a folder with millions of files in the server

File name will be LMN20110305.txt pattern.

If i am trying to search for files in april only am now reading directory

getting the filename and using substring am checking it is greater than or less than of

20110401 and 20110430

In this case it will read entire directory and it is taking so many hours.
Am thinking about checking create date also.

How will be the performance of glob — Find pathnames matching a pattern

Any one have any better suggestion?

Silly doubt! Is it possible to find the files without searching entire directory?

  • 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-05-21T21:29:32+00:00Added an answer on May 21, 2026 at 9:29 pm

    glob() will perform fine. It’s in the standard library for a reason, use it!

    It’s my understanding that glob() maps almost directly to the glob() function in your system’s C library, meaning that it will most likely be more efficient than anything you roll your own. The only limit is memory: if you run out of memory, you’ll either need to give PHP more memory or reorganize.

    If you run in to memory problems, how about organizing your files a little better? A million files in one folder is way too many. Organize them somehow. If your files are dated, try organizing them by year (and then maybe month), along the lines of:

    basedir/
    |---/2011
    |---/2010
    etc.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a folder structure and files on SDCard.When i'm trying to view
I am having a file called demo.png which is saved in the documents/test/ folder.
I'm having trouble with my Apache Web Server. I have a folder (htdocs\images) where
What is a benefit of having build/ folder where all the sources will be
I am having sql server express edition local database in app_data folder. How can
In svn Repository having a folder exProject.(which contains all the proj files) . In
i have a folder having an html in a folder and javascript files, can
I'm having some issues with loading a (.properties) file from the webcontent folder in
I am having a folder called db . where it contains 3 files which
I have 10 zip files in a folder having path like this TargetDirectory =

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.