Questions tagged [opendir]

A PHP, PERL, C library function for opening a directory handle. Questions are about the workings or issues with the opendir function.

The opendir() function is used to open up a directory handle to be used in subsequent closedir(), readdir(), and rewinddir() calls.

Links:

Related

262 questions
1
vote
1 answer

PHP Readdir sorting by creation date

Somewhat based on a source I found online, but I want it to sort videos by creation/modification date. I've tried a number of solutions, but can't seem to find or come up with one that I am really satisfied with. I'd greatly appreciate if someone…
1
vote
0 answers

AAssetManager_openDir takes long to execute

I have a problem with AAssetManager_openDir method taking long to return. It is not affecting all devices, it looks like it is quite fast on ART devices (only my guess). I've tested it on Nexus 5X - powerfull ART device and on Samsung Galagys S4…
bio007
  • 893
  • 11
  • 20
1
vote
1 answer

Use opendir one time instead of using it in for loop

I have below code to get content from remote directory. $dirHandle = opendir("ssh2.sftp://$sftp/".PATH_OUT); while (false !== ($file = readdir($dirHandle))) { // something... } Now, the thing is, above code is in forloop. when I put $dirHandle =…
RNK
  • 5,582
  • 11
  • 65
  • 133
1
vote
1 answer

Sort Images in while loop (no mysqli)

I want to get picture from few sub-folder in a directory and i want to sort them as data. with the Following code I got the images now i want to sort them as data. Note every image name starts with the date and time of uploading example :- default…
saqib kifayat
  • 136
  • 2
  • 14
1
vote
3 answers

Accessing Directories in C

The program is to open a directory and to display the name of the files... i.e if there is a file..it should say FILE....else DIRECTORY.. but the program displays all the files as directory.. Could anyone pls check the code for any errors....thnx…
Vinod K
  • 1,885
  • 11
  • 35
  • 45
1
vote
0 answers

opendir warning acces denied, shows two params instead of one

i have just silly question. When i have this code in PHP $dirResult = opendir($pathReal); where path real is string contains path to file, i get error Warning: opendir(\149.223.22.11\cae\04_Knowledge-base,\149.223.22.11\cae\04_Knowledge-base):…
Luboš Suk
  • 1,526
  • 14
  • 38
1
vote
1 answer

Code to create a nested array of all files in a directory & subdirectories with PHP is not working

I'm attempting to use a sample function on the PHP manual website (posted by a user). The function is supposed to return a nested array of all of the files and/or folders in a specified directory of your server. I'm just learning php, so I think…
Baa
  • 825
  • 1
  • 6
  • 16
1
vote
3 answers

PHP List Images In Folder

I have the following code // Define the full path to your folder from root $path = "../galleries/".$album; // Open the folder $dir_handle = @opendir($path) or die("Unable to open $path"); // Loop through the files …
ChrisMJ
  • 1,620
  • 4
  • 21
  • 27
1
vote
2 answers

PHP - create pagination from an opendir array (photo gallery page)

I had done this using my MySQL db, but about a year ago, I revamped my site to a more conveniently-coding layout for my photography thumbnails. Someone else had written the code, and it uses the opendir functionality to auto-create thumbnail images…
sleepywan
  • 27
  • 1
  • 5
1
vote
0 answers

opendir sleeps or infinite loop the program

I'm making a simple LS command in C in a program, when I open the directory for the first time and read it, it works perfectly, but when I call the function a second time, opendir() seems to sleep or loop infinitely: int server_list(t_server_data…
Aurelien
  • 339
  • 3
  • 12
1
vote
2 answers

pointer to char changes after opendir() system call

i am currently trying to delete directories from system call using c and i am facing a weird problem. In my deleteFunction() after using the char * path to open the directory. the value of path changes here is part of the code: #include…
Tarounen
  • 1,119
  • 3
  • 14
  • 25
1
vote
1 answer

list directory and display details of each file. owner, octal permissions and filename using c

I'm trying to create a method that will do some system calls. It should display the owner of and octal code of each file. but somehow I cant get going. It displays the logged in user name as owner of each file listContents(char * dir) { struct…
Tad Lithuania
  • 105
  • 1
  • 9
1
vote
1 answer

Trying to open (and create if not exists) file on mapped network drive in PHP

I've got a mapped network drive 'Z://' and my PHP file is stored on my 'C://' drive. When trying to use opendir() or fopen() I keep getting the errors. The reason for the mapped drive is because I was having issues writing into the drive…
Chuck
  • 119
  • 3
  • 20
1
vote
1 answer

Problems grabbing file names using SDL_strdup and similar

I'm trying to create a program with SDL2. In a certain part of the code, I'm writing functions to grab names of all present files in a given directory path (and keep them in memory) so that, in another function, I can check if a specified file was…
user4103007
1
vote
1 answer

opendir() in C Programming

I'm a beginner and I am making a code about getting the directory of a file, but I have something that I don't understand. What's the meaning of "./" in DS = opendir ("./"); I have searched a lot of sites about C programming, but nothing gave me a…
AmperSand
  • 15
  • 1
  • 1
  • 6