Xianoth Posted October 16, 2007 Share Posted October 16, 2007 Ok this is what I would like the script to do. 1: scan a target directory and save file information into a mysql db. a. filename b. filesize c. last modified timestamp d. file location 2. Display directory and allow the list to be modified via Last modified, filesize or name. ascending or descending. 3: Allow the directory list to be searched and have displayed results also be affected by point 2. 4. Allow the filename displayed to be a clickable download. Any help to point me into the direction of an existing script that can do this would be extremely helpful. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/73504-looking-for-a-script-to-do-the-following/ Share on other sites More sharing options...
jeet_0077 Posted January 6, 2008 Share Posted January 6, 2008 function scanDir($dirname) { if (is_dir($dirname)) { //Operate on dirs only $result=array(); if (substr($dirname,-1)!='/') {$dirname.='/';} //Append slash if necessary $handle = opendir($dirname); while (false !== ($file = readdir($handle))) { if ($file!='.' && $file!= '..') { //Ignore . and .. $path = $dirname.$file; // You can write ur sql query here to insert // You have the file name and path but need to //use some file fuctions to get the other things. // Or you can return the array and get the file and path // one by one and can do the operation } } closedir($handle); $result[].=$dirname; return $result; //Return array of items }else{ return false; //Return false if attempting to operate on a file } } Quote Link to comment https://forums.phpfreaks.com/topic/73504-looking-for-a-script-to-do-the-following/#findComment-431851 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.