dennismonsewicz Posted March 26, 2008 Share Posted March 26, 2008 Is there anyway to have fread(), fopen(), or any other f functions to crawl a directory and grab the files and strip the name of the files and size of the files? Link to comment https://forums.phpfreaks.com/topic/97923-fread-and-directory-crawling/ Share on other sites More sharing options...
dennismonsewicz Posted March 26, 2008 Author Share Posted March 26, 2008 if not using fread or any f functions then could this be achieved by doing anything else? BUMP Link to comment https://forums.phpfreaks.com/topic/97923-fread-and-directory-crawling/#findComment-500989 Share on other sites More sharing options...
dennismonsewicz Posted March 26, 2008 Author Share Posted March 26, 2008 bump Link to comment https://forums.phpfreaks.com/topic/97923-fread-and-directory-crawling/#findComment-501229 Share on other sites More sharing options...
lordfrikk Posted March 26, 2008 Share Posted March 26, 2008 If you want to iterate through the directory's files, then you can do it this way: <?php $dir = dir("."); while ( $file = $dir->read() ) { // here goes the file handling code } ?> Link to comment https://forums.phpfreaks.com/topic/97923-fread-and-directory-crawling/#findComment-501287 Share on other sites More sharing options...
dennismonsewicz Posted March 26, 2008 Author Share Posted March 26, 2008 $dir = dir(".") -> is this where I put the path to my directory? and what kind of file handling code would i use? Link to comment https://forums.phpfreaks.com/topic/97923-fread-and-directory-crawling/#findComment-501307 Share on other sites More sharing options...
lordfrikk Posted March 26, 2008 Share Posted March 26, 2008 Yes, that's where the directory path goes. Well you said something about stripping filenames and getting file sizes, so that's what I meant by "file handling". Link to comment https://forums.phpfreaks.com/topic/97923-fread-and-directory-crawling/#findComment-501316 Share on other sites More sharing options...
dennismonsewicz Posted March 26, 2008 Author Share Posted March 26, 2008 Gotcha. I found a tutorial online and I am going to use what you suggested. I also need to dump the filenames into a Database. I am basically creating a stock photo site but instead of having to upload each individual file i am trying to just dump all of the photos in respected DIRs and have a PHP file do the dirty work Link to comment https://forums.phpfreaks.com/topic/97923-fread-and-directory-crawling/#findComment-501332 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.