elkidogz Posted August 17, 2007 Share Posted August 17, 2007 quick simple, need a list of all files (i have like 5k or so) in a folder, I need to add there names to a table I am doing this so i can compare two tables table 1. comments added to uploaded pics -finished pictures- table 2. no comments added yet to uploaded pics (so they can be commented on GET IT?) -unfinished pictures- All the pictures are in a single folder for the time being i'm going to be making a form based on the pictures that are on table 2 so that they can have comments and titles and file name added to table 1 (to be done still) but i need to know all the file names for the folder in question, i guess i could do it via cmd line ls or something like that, i'll get back to you. Link to comment https://forums.phpfreaks.com/topic/65515-solved-how-does-one-get-a-list-of-all-files-in-a-folder/ Share on other sites More sharing options...
cypr Posted August 17, 2007 Share Posted August 17, 2007 scandir(directory,sort,context); Parameter Description directory Required. Specifies the directory to scan sort Optional. Specifies the sort order. Default is 0 (ascending). If set to 1, it indicates descending order context Optional. Specifies the context of the directory handle. Context is a set of options that can modify the behavior of a stream it will return an array you can use it like this: scandir("images"); where images is the directory where you run the php file.... u get the idea....if directory is somewhere else...include the path Link to comment https://forums.phpfreaks.com/topic/65515-solved-how-does-one-get-a-list-of-all-files-in-a-folder/#findComment-327132 Share on other sites More sharing options...
Orio Posted August 17, 2007 Share Posted August 17, 2007 Each of these will give you what you want: $files = scandir(); $files= glob("*.*"); for($l=opendir("."); ($file = readdir($l)) !== FALSE; $files[] = $file) And I guess there are more options. Orio. Link to comment https://forums.phpfreaks.com/topic/65515-solved-how-does-one-get-a-list-of-all-files-in-a-folder/#findComment-327133 Share on other sites More sharing options...
elkidogz Posted August 17, 2007 Author Share Posted August 17, 2007 kewl thanks Link to comment https://forums.phpfreaks.com/topic/65515-solved-how-does-one-get-a-list-of-all-files-in-a-folder/#findComment-327141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.