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
0 answers

Is readdir_r atomic?

I'm planning to create a function that relies on readdir function with mutexes added for better multithreading handling (because the function can return a shared static variable that can be modified by different calls to the function). Although, the…
0
votes
2 answers

Twig Code for a List of all files which are in {{file_location}} Symfony2

So far I have managed to show "the last file" in my twig view, and all of them over the controller which appears on my page at first line before the header. Now, I need to display all in the twig view. This is my code: controller public function…
Ose Crea
  • 21
  • 4
0
votes
2 answers

PHP: Copy entire contents of a directory

Sorry for new post! I'm not yet trusted to comment on others posts. I'm having trouble copying folders and this is where I started: Copy entire contents of a directory Function function recurse_copy($src,$dst) { $dir = opendir($src); …
Andreas
  • 37
  • 1
  • 11
0
votes
3 answers

C readdir & struct dirent allocation

readdir return a pointer to a struct dirent, I have tested if two calls to readdir stored in two different pointers modify the first pointer content, it doesn't. So I guess readdir allocate some memory, am I right ? If so, it should be released,…
0
votes
2 answers

Can you list files in a directory with JavaScript but without ActiveX?

I wrote a script in php that allows me to get a list of files in a directory as an array, parse each one for a particular string, and then it displays all of the files that contain the search string. My IT staff won't let me install php on the…
Baa
  • 825
  • 1
  • 6
  • 16
0
votes
1 answer

sftp malformed FXP_NAME packet

I am trying to get a simple sftp-client using node.js. I am using ssh2 (Reference). But as soon as i connect using FileZilla i get this: Command: pwd Response: Current directory is: "/server/" Status: Directory listing successful Status:…
0
votes
1 answer

How can I list files in a directory by modification date?

Currently I'm using readdir and it is working fine. Now time has come where my folders are cluttered and searching through a list by alphabetical order (not guaranteed though, it's directory order) can be frustrating. So, how can I modify the code…
Corey Iles
  • 155
  • 1
  • 17
0
votes
1 answer

Sort array by date before pagination after readdir

I have code to display images from a folder with pagination. I need to alter it so that it displays the newest image first on page one, and the oldest on the last page. I have tried a few methods but nothing seems to work. Please help! $mydir =…
0
votes
2 answers

Permission denied warning on unlink

I am trying to a delete file selected using a dropdown. I am getting an error 'undefined index "file"' and permission denied warning on unlink.
0
votes
2 answers

Get files from 1 directory and read files in another, than match files with file contents

To explain what I mean, I have 1 directory containing images. I have another containing text files with information about the images. I want an array with each image matched with another array containing its data. My head is beginning to explode…
Jake Stanger
  • 449
  • 1
  • 8
  • 24
0
votes
1 answer

segmentation fault in my c code

I am getting segmentation fault in my code what is the reason for that. I think this is because of while loop in cur = readdir(dr); it is not entering into while loop when I am trying to give wrong entry. int main(char *source) { DIR *dr; …
0
votes
1 answer

Problems with readdir() and fgets

I'm writing a code where I can be given a directory of .txt files, and specific strings that appear throughout each file, and do some simple comparisons. code chunk will be posted below. So, My task:Open directory>open file>compare strings>open next…
Liam King
  • 1
  • 1
0
votes
1 answer

Remove dot in get list of files in directory

How can I remove the dot before the last trailing slash? Example with dot output in HTML table: Name Type Size Last Modified http://www.airsahara.in./fares/ text/x-php 662 …
Mike
  • 607
  • 8
  • 30
0
votes
1 answer

how to test ReadDir for nfs server

I've modified some of the nfs server functions using another server connecting between the client and the server. I would like to test the ReadDir function for NFS, but whatever I try to test it, the command sent is ReadDirPlus (ls, ls -l etc.) is…
Itay Sela
  • 942
  • 9
  • 26
0
votes
1 answer

Search inside all files of a Directory and then move using PHP

I have some issues, I need to search an specific text inside all the files of a directory, if the text appears inside one or more TXT I need to copy the file to two folders, and then delete the original one. This is the code that I have so far (I…