Questions tagged [readdir]

The C, Perl or PHP library function for reading from an open directory.

The readdir C library function reads and returns the next entry, as a struct dirent *, from an open DIR *. You should open the directory using opendir first. This can also refer to the Perl or PHP functions with the same purpose.

Links:

301 questions
0
votes
1 answer

PHP: How to run readdir() as root

I am trying to make a lightweight frontend for my fileserver. I use PHP to display all the files, but readdir() is executed as the http user, because apache is started as this user. This is a problem, because I want to view all my files. Therefore,…
Ben
  • 1
0
votes
1 answer
0
votes
1 answer

PHP function - Ordering of readdir file listing is odd

I have some PHP script that reads an image directory and echos out the results of the users search. I need to find a way of sorting these search results from the directory, I know you can use natsort() on an array but this does not help as the…
0
votes
1 answer

How to hide . and .. folders in C?

I'm trying to list all folders and all files of a folder with the language C. This is the following code: #include #include #include #include int main (int argc, char *argv[]) { struct dirent…
Lord Rixuel
  • 1,173
  • 6
  • 24
  • 43
0
votes
1 answer

How to skip mounted files when walking through a directory tree with readdir_r

I am writing a function that recursively deletes all files and sub-directories in a directory tree, and this function will be used in multithread environment, so I would prefer opendir/readdir_r than nftw (the code is for Linux/Mac OSX/Solaris,…
vantaa
  • 15
  • 5
0
votes
1 answer

PHP permission denied to readdir even though its the same user and group

Ive created a folder in my Gnome Desktop called "olli" and put some files in there. The folder is owned by the user "olli" and group "olli" I then run this script
0
votes
1 answer

Reading a directory with php

This used to be located at http://elijahhoffman.com/index.php?q=editorial&z=one and is now located at http://elijahhoffman.com/editorial/one the folder path used to read just 'galleries/editorial_i'; but it wasn't working, i assumed because of the…
rootsup
  • 315
  • 2
  • 17
0
votes
4 answers

I need to sort php jquery gallery script alphabetically

know nothing about php, but I have this script that reads a folder and displays a thumbnail gallery, problem is it dosent display alphabetically. Have searched the net and seen that sort does this but have no idea where to start any help would be…
0
votes
2 answers

PHP iterate over directory files

I have this simple code if ($hdcss = opendir($javascript)) { while (false !== ($cssentry = readdir($hdcss))) { echo "$cssentry\n"; } closedir($hdcss); } This will give out all files... What I want to do since I'll be getting…
EasyBB
  • 6,176
  • 9
  • 47
  • 77
0
votes
1 answer

can I order the readdir?

I have this code displaying a list of files but they appear in what seems like a random order, is there anyway to put them in an order eg. last uploaded, last modified or even alphabetical? any help would be very much liked.
0
votes
0 answers

Does the DirectoryIterator read the entire directory?

So I'm a bit confused about how the DirectoryIterator works. Let's say I have a directory with 100000 files. Using the readdir() function I could easily walk through the entire file list without any performance hits, because the function gets me one…
thelolcat
  • 10,995
  • 21
  • 60
  • 102
0
votes
0 answers

readdir doesn't work properly in linux system

EDITED with full code : int filename_extract(){ DIR *pDIR; struct dirent *entry; string file; try{ if((pDIR=opendir("/home/xxx/Documents/enron_mail_20110402/maildir/allen-p/all_documents")) != NULL){ while((entry =…
annunarcist
  • 1,637
  • 3
  • 20
  • 42
0
votes
1 answer
0
votes
1 answer

probleme to list with readdir

I want to list a folder but when I want to print the filename only \n are print void liste_folder(void) { DIR *dir; struct dirent *test; dir = opendir("."); while (readdir(dir) != NULL) { test =…
leykan
  • 389
  • 2
  • 4
  • 24
0
votes
1 answer

Start new column when readdir moves to new dir

Original Issue: I am using readdir to snag file names from multiple directories. I was wondering if there is a way to arrange the data so that each time it starts a new directory it makes a new column i.e. ---| user1 | user2 | user3 | ---|…