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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:44:39+00:00 2026-05-24T07:44:39+00:00

I was using this readdir to find a file in a folder $handler =

  • 0

I was using this readdir to find a file in a folder

$handler = opendir($folder);

while ($file = readdir($handler)) {

  if ($file != "." && $file != ".." && substr($file,0,7) == '98888000') {
    print $file. "<br />";
  }

}

but since I have tons of files in the folder it takes some minutes to complete the request: how can I fast it up?
Consider I’m on PHP5 + IIS.

I’ve tried even glob()

foreach (glob($folder.98888000."*.pdf") as $filename) {
    echo "$filename size " . filesize($filename) . "\n";
}

but it returned nothing.

  • 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-24T07:44:40+00:00Added an answer on May 24, 2026 at 7:44 am

    What about glob maybe? It finds files matching a pattern:

    glob('98888000*')
    

    might work.

    If you need opendir and readdir, then you might want to have a look at fnmatch.

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

Sidebar

Related Questions

Using this xslt file found on this blog to pretty print xml using Nokogiri,
function file_list($path){ $final_result=array(); if ($handle = opendir($path)) { while (false !== ($file = readdir($handle)))
Using this file as source, I have a situation where I need to retrieve
Using this code to zip a folder and it works perfect on small files
I'm using this code for moving files from directories but I need 2 changes
Using this below code i get the name only first 4 character.But i need
Using this hook with VisualSVN Server, added to the Repository/hooks folder as pre-commit.bat. My
I am using Perl readdir to get file listing, however, the directory contains more
In the typical file matching code: while (false !== ($file = readdir($handle))) { if
Under Linux I can open a directory using opendir and then use readdir to

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.