Jump to content

Recommended Posts

I don't think that is what I need...

 

 

I would like to have a code on my site that will make a list of all the files on a users website. Basically, I want the user to come and copy this code to a file on their website, and then the code will be placed in the root folder of their site. When the code runs, I would like it to grab every file textual web file they have created, such as some of these formats:

html,htm,php,shtml,asp,dhtml,txt

 

This would also search all subdirectories as well, and save those URL's too.

 

The EXACT URL of each file will then be saved to a txt file that will be saved in their root directory.

 

I would like it to ignore all image files, exe files, and anything that would not contain textual content that can be displayed on the web.

 

anyone know of a way to do this?

<?php
function kids($dir, $allowed_extensions)
{
    if ($handle = opendir($dir))
    {
        $output = array();
        while (false !== ($item = readdir($handle)))
        {
            if (is_dir($dir.'/'.$item) and $item != "." and $item != "..")
            {
                $output = array_merge($output, kids($dir.'/'.$item, $allowed_extensions));
            }
            elseif(is_file($dir.'/'.$item) and
                   in_array(preg_replace('/^.*((?<=\.)[^.]+)$/', '$1', $item), $allowed_extensions))
            {
                $output[] = $dir.'/'.$item;
            }
        }
        closedir($handle);
        return $output;
    }
    return false;
}
print_r(kids('.', array('html','htm','php','shtml','asp','dhtml','txt','cmf','jsp','aspx'))); 
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.