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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:36:27+00:00 2026-05-25T11:36:27+00:00

I cannot seem to get the bolded file path to work. I would like

  • 0

I cannot seem to get the bolded file path to work. I would like the script to scan Dir_3. Any help would be very appreciated.

 <?php

  // These files will be ignored
  $excludedFiles = array (
'excludeMe.file',
'excludeMeAs.well'
);

// These file extensions will be ignored
$excludedExtensions = array (
  'html',
'xslt',
'htm',
'ahk',
'xsl',
'txt',
'xml'
);

// Make sure we ignore . and ..
$excludedFiles = array_merge($excludedFiles,array('.','..')); 

 // Convert to lower case so we are not case-sensitive
 for ($i = 0; isset($excludedFiles[$i]); $i++) $excludedFiles[$i] =        
 strtolower(ltrim($excludedFiles[$i],'.'));
  for ($i = 0; isset($excludedExtensions[$i]); $i++) $excludedExtensions[$i] =    
 strtolower($excludedExtensions[$i]);

  // Loop through directory
  $count = 0;
  if ($handle = opendir('**http://www.mydomain.com/Dir_1/Dir_2/Dir_3/**')) {
  while (false !== ($file = readdir($handle))) {
  $extn = explode('.',$file);
  $extn = array_pop($extn);
  // Only echo links for files that don't match our rules
  if (!in_array(strtolower($file),$excludedFiles) &&   
  !in_array(strtolower($extn),$excludedExtensions)) {
    $count++;
    print("<a href=\"".$file."\">".$file."</a><br />\n");
  }
}
echo '<br /><br /><a href="..">Return</a>';
closedir($handle);
}

?>
  • 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-25T11:36:27+00:00Added an answer on May 25, 2026 at 11:36 am

    You cannot ‘opendir’ a URL. But you can specify relative and absolute PATHS in opendir:

    opendir('.') // open current directory
    opendir('..') // open parent directory
    opendir('childdir') // open the 'childdir' directory which exists in the current directory (.)
    opendir('childdir/grandchilddir') // open a grandchild directory down two levels from the current dir
    opendir('../brotherdir') // open a directory next to the current one
    opendir('../brotherdir/nephewdir') // open a director next to and down one
    opendir('../..') // open a grandparent directory
    opendir('../../uncle') // yada yada yada
    
    opendir('/') // open the root dir (primordial slime/adam, depending on your viewpoint)
    opendir('/cain') // open a dir called "cain" which is housed in the root directory.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cannot seem to get this script to work. Can anyone please help? The
I have this design which I cannot seem to get right, I would like
I cannot seem to get this to work. Any thoughts? <html xmlns=http://www.w3.org/1999/xhtml> <head> <meta
I cannot seem to get this to work. I have a small JS file
Folks, This is easy, but I cannot seem to get this right, any help
This is a very old problem, but I cannot seem to get my head
I cannot seem to get the following to work directory <- ./ files.15x16 <-
I cannot seem to get my try/catch to work correctly. When you implement a
I am trying to get this code to work but cannot seem to get
Just hit a very odd issue with databinding which I cannot seem to get

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.