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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:14:07+00:00 2026-06-07T22:14:07+00:00

How can I search a specific directory and its subdirectories for a specific file?

  • 0

How can I search a specific directory and its subdirectories for a specific file?

What I’ve tried are the following two functions:

function getImageDirectory($ipaPath) {
    $oDirectory = new RecursiveDirectoryIterator($ipaPath);
    $oIterator = new RecursiveIteratorIterator($oDirectory);
    foreach($oIterator as $oFile) {
        if ($oFile->getFilename() == 'info.plist') {
           return $oFile->getPath();
        }
    }
}

EDIT: This one works, just as well as the answer bellow! My example above return the directory of the file you are looking for, in this case “info.plist”.

EDIT2: Thanks for the down votes! If someone would have asked a similar question it would have shown when I wrote the title. But nothing for PHP. So if I search for the wrong thing, not using developer language it shouldn’t be down voted! And now someone with my low php skills might find an answer to this question! Is stackoverflow only for PRO’s or for anyone that needs help?

  • 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-07T22:14:09+00:00Added an answer on June 7, 2026 at 10:14 pm

    As @diEcho suggested, use glob.
    Get file list like this:

    <?php
    foreach( glob( "*.*" ) as $filename ) {
      echo "$filename size " . filesize( $filename ) . "\n";
    }
    ?>
    

    After that, just go through the results. You might need a recursive function, to access subfolders though.

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

Sidebar

Related Questions

I need to be able to Search a directory and its subdirectories for specific
I am using the following to search a directory recursively for specific string and
How can I search for a specific version of a package using the Manage
How can I use a a search filter to display users of a specific
This is quite weird but my search function can search for any word except
I'm trying to create a function that goes to a specific directory, and if
How can I make my pages search engine friendly by showing as a directory
We can search for specific field on website in a few ways: based on
I am trying to search for a file under specific path/location. Sample Path -
Can someone show me how to parse out specific information from an xml file?

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.