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.

 

 

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.