درخواست معرفي اسكريپت

dafsab

تازه وارد
با سلام

:) :)دوستان عزيز :) :)

سوالي داشتم.آيا اسكريپتي هست كه از فايل هاي داخل يك پوشه فقط آن هايي كه در نامشان يك كلمه(مثلا red) وجود دارد را نمايش دهد.

با تشكر از يكايك شما

 

Mohammad

مدیر انجمن
پرسنل مدیریت
اسکریپت ساده ای هست که می تونه تمامی فایلهای یک مسیر رو نشون بده. حالا برای پسوند یا نام دلخواه باید شرط رو تغییر بدی


کد:
<? 
/** 
* Change the path to your folder. 
* This must be the full path from the root of your 
* web space. If you're not sure what it is, ask your host. 
* 
* Name this file index.php and place in the directory. 
*/ 
    // Define the full path to your folder from root 
    $path = "/home/content/s/h/a/shaileshr21/html/download"; 

    // Open the folder 
    $dir_handle = @opendir($path) or die("Unable to open $path"); 

    // Loop through the files 
    while ($file = readdir($dir_handle)) { 

    if($file == "." || $file == ".." || $file == "index.php" ) 

        continue; 
        echo "<a href=\"$file\">$file</a><br />"; 

    } 
    // Close 
    closedir($dir_handle); 
?>
 
بالا