Jump to content

[SOLVED] How does one get a list of all files in a folder?


elkidogz

Recommended Posts

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.

 

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.