Results 1 to 3 of 3
-
8th Jan 2012, 01:07 PM #1OPMember
[PHP] Create Filelist of files with Specific Extensions
Hey Guys ,
Any idea how to create a filelist of a location via php with files with a specific extension :
E.g : .avi
let's say the location is "/location/folder1/"
Inside i have : Folderx , folderz , file1.avi , file2.avi , file2.rar
Now i want to create a filelist of that folder using only files with .avi ext .
viruz99 Reviewed by viruz99 on . [PHP] Create Filelist of files with Specific Extensions Hey Guys , Any idea how to create a filelist of a location via php with files with a specific extension : E.g : .avi let's say the location is "/location/folder1/" Inside i have : Folderx , folderz , file1.avi , file2.avi , file2.rar Rating: 5
-
8th Jan 2012, 01:18 PM #2MemberWebsite's:
wscripts.net damnlolscript.com lulzjet.comPHP Code:function read_dir($dir) {
$handle = opendir ($dir);
while (false !== ($f = readdir ($handle))){
if ($f != "."){
if ($f != ".."){
$file=$dir.$f;
if(is_file($file)) {
$ext = strtolower(substr($file, strrpos($file, '.') + 1));
if($ext == 'avi') echo $file.'<br />';
}
}
}
}
}
read_dir('full_path_to_dir');
-
8th Jan 2012, 01:48 PM #3Respected MemberWebsite's:
DL4Everything.com Soft2050.inPHP Code:<?php
$folder = array(); // Creates a array for use later
foreach (glob("/location/folder1/*.avi") as $thefolder) { // Use for each to go through and get each folder & file in the given directory
If (is_file($thefolder)) { // We only want to get files so we are making sure that we are adding a file and not a directory.
$folder[] = $thefolder; // Adds the file to the array created
}
}
print_r($folder); // Print out the list for debug
?>
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
5 IE9 extensions you should know about
By CyberPrince in forum News & Current EventsReplies: 0Last Post: 8th Nov 2011, 01:06 AM -
Adding specific words to all TXT files at the same time
By astalavistia in forum Web Development AreaReplies: 6Last Post: 24th Apr 2011, 11:57 AM -
I'm Uploading Files Manually Now, So How To Change MD5 & Create Screens?
By elpirata in forum Webmaster DiscussionReplies: 2Last Post: 23rd Feb 2011, 02:06 PM -
create dummy file with specific size in php
By techdaemon in forum Webmaster DiscussionReplies: 0Last Post: 28th Sep 2010, 12:55 AM -
[linux] Create video thumbnails for all video in a specific folder
By Snell in forum Tutorials and GuidesReplies: 7Last Post: 26th Jul 2010, 08:33 AM
themaLeecher - leech and manage...
Version 4.94 released. Open older version (or...