Current location: Hot Scripts Forums » General Community » Script Requests » Html files in directory overview script


Html files in directory overview script

Reply
  #1 (permalink)  
Old 11-15-09, 03:49 PM
twincepto twincepto is offline
New Member
 
Join Date: Nov 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Html files in directory overview script

I have a folder called "videos" which contain 20-30 small videos, inside this folder is another folder called "info" which contain an image and a text file for each of the videos and with the same filename.

What I'm looking to do is to make a .html file which contain somekind of script that will read the files in the directories and list all the videos with the image and the information in the text file and a link that will launch the video to be played by a media player...

Does anyone know of a simple and quick way to do this?

Also I'm hoping this can be done with a script language that doesn't require me running a webserver...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-15-09, 05:10 PM
pyr0t3chnician pyr0t3chnician is offline
Newbie Coder
 
Join Date: Jul 2009
Posts: 30
Thanks: 0
Thanked 1 Time in 1 Post
HTML and javascript alone might not cut it for what you want. You would probably need to use some sort of ActiveX script to do what you are looking for. I can't help you for that, but if you want to do the webserver version (install XAMPP or WAMP or whatever first), here is the PHP. I grabbed a bunch of snippets off the web and added some code to make this. It may work, it may not. You may have to tweak it, but it should be the very basic version to get the job done. Let me know.
PHP Code:

function dirList ($directory
{

    
// create an array to hold directory list
    
$results = array();

    
// create a handler for the directory
    
$handler opendir($directory);

    
// keep going until all files in directory have been read
    
while ($file readdir($handler)) {

        
// if $file isn't this directory or its parent, 
        // add it to the results array
        
if ($file != '.' && $file != '..')
            
$results[] = substr($file,0,(strlen($file)-4));// the file name minus the ".jpg" 
    
}

    
// tidy up: close the handler
    
closedir($handler);

    
// done!
    
return $results;

}

$moviedirectory="/movies/";
$infodirectory="/movies/info/";
$pictype=".jpg";//picture type
$info=".txt";//file type for the info files
$moviefile=".avi";//movie file type
$list=dirList($moviedirectory);
echo 
"<table>";
foreach(
$list as $file)
{
     echo
"<tr>";
     
//display image
     
echo"<td><img src='".$infodirectory.$file.$pictype."'></td>";
     
//get info file text
     
$myFile $infodirectory.$file.$info;
     
$fh fopen($myFile'r');
     
$theData fread($fhfilesize($myFile));
     
fclose($fh);
     echo 
"<td>".$theData."</td>";
     
//The movie file link
     
echo "<td><a href='".$moviedirectory.$file.$movie."'>Movie Link</a></td>";
     echo 
"</tr>";
}
echo 
"</table>"

Last edited by pyr0t3chnician; 11-15-09 at 05:21 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-16-09, 07:21 AM
twincepto twincepto is offline
New Member
 
Join Date: Nov 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for the PHP version pyr0t3chnician, like I said not what I'm looking for... but at least its a backup option if nothing else works out. The things is I'm just running this locally not on the web... so running a webserver for this simple task is kind of overkill and somewhat a bother

Another thought - instead of making this dynamic html page with some sort of script, perhaps I could use batch or vbscript or something to output a static html page? Now I would have to run the script everytime I updated stuff... but still a better solution right?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Product Listing Directory Script ZioCax Script Requests 0 06-15-08 02:06 PM
Certain Type of Directory script! chrissatchwell Script Requests 4 03-13-07 06:46 AM
Automated script to delete certain files shib_s Script Requests 3 08-03-06 06:28 PM
Upload Script Problem!!! seanknighton Perl 0 03-21-04 10:54 PM


All times are GMT -5. The time now is 01:42 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.