readdir Questions

49

Solved

Any ideas on an async directory search using fs.readdir? I realize that we could introduce recursion and call the read directory function with the next directory to read, but I'm a little worried a...
Discoid asked 29/4, 2011 at 3:44

4

Solved

When reading a directory, I currently have this: fs.readdir(tests, (err, items) => { if(err){ return cb(err); } const cmd = items.filter(v => fs.lstatSync(tests + '/' + v).isFile()); ...
Freewill asked 13/7, 2018 at 21:42

4

Solved

I am making a program which is run in a Linux shell, and accepts an argument (a directory), and displays all the files in the directory, along with their type. Output should be like this: <&l...
Oliguria asked 30/5, 2014 at 15:23

2

I've used this kind of code in my Dev-cpp before: if((dh = opendir(folder)) !== false){ while((file = readdir(dh)) !== false){ // do my stuff } closedir(dh); } But now i am using MSVC++ and ...
Accumulation asked 19/5, 2009 at 15:54

5

The C routines opendir(), readdir() and closedir() provide a way for me to traverse a directory structure. However, each dirent structure returned by readdir() does not seem to provide a useful way...
Toothsome asked 22/2, 2010 at 15:57

2

Solved

I would like to scan the folder, but ignore all the folders/directories that are included in it. All I have in the (C:/folder/) are .txt files and other folders, I just want to scan the txt files, ...
Echeverria asked 4/1, 2017 at 19:51

4

Solved

I have a folder called allfiles, and there are some files in this folder, such as 1212-how-to-sddk-thosd.html 3454-go-to-dlkkl-sdf.html 0987-sfda-asf-fdf-12331.html 4789-how-to-fdaaf-65536.htm...
Positivism asked 25/1, 2018 at 13:51

7

Solved

I'm getting a list of files on a linux-like system using opendir/readdir. It appears that the directory entries are returned in alphabetical order of file name. However, I don't see anything in the...
Khachaturian asked 23/1, 2012 at 19:30

1

Solved

I have the following code that mimicks ls: #include <dirent.h> #include <stdio.h> char* dirent_type_to_str(unsigned char dirent_type) { switch (dirent_type) { case DT_DIR: return "...
Bascio asked 2/11, 2017 at 15:1

2

Solved

I am running Perl in Windows and I am getting a list of all the files in a directory using readdir and storing the result in an array. The first two elements in the array seem to always be "." and ...
Scut asked 10/5, 2016 at 20:31

3

I use opendir() to open a directory and then readdir() and lstat() to get the stats of each file in that directory. Following this manpage I wrote the code under which doesn't work as thought. It d...
Busch asked 6/10, 2011 at 12:33

4

Solved

Is there any way to guarantee an order from the list returned by readdir? I have the code: opendir(my $DIR, $src) or die "Error opening $src"; # Loop for each file in the directory while (my $fi...
Astronomical asked 28/5, 2013 at 13:13

6

I have the following code <?php if ($handle = opendir('C:/xampp/htdocs/movies')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo $file."&lt...
Abreaction asked 27/1, 2009 at 4:50

2

I have a little problem. I'm reading files from directory and it works, but it read two extra files on the beginning ...what is it? for example, there is a list of files: "A348", "A348A", "A...
Varner asked 28/11, 2013 at 11:44

3

Solved

i have a little php script that reads a directory and then echos all the files (jpg's in this case) into a jquery image slider. it works perfectly, but i dont know how to sort the images by name de...
Danille asked 7/8, 2013 at 18:15

7

Solved

I'm using the following PHP code to list all files and folders under the current directory: <?php $dirname = "."; $dir = opendir($dirname); while(false != ($file = readdir($dir))) { if(($...
Jessalin asked 20/10, 2010 at 11:57

3

I have a directory that holds ~5000 2,400 sized .txt files. I just want one filename from that directory; order does not matter. The file will be processed and deleted. This is not the scripts w...
Cedar asked 8/5, 2013 at 14:38

3

Solved

I have started working with dirent.h library and I came across a very useful member of "struct dirent" structer which struct dirent *p->d_name in my book. But unfortunatly it doesn't states any oth...
Duncandunce asked 20/10, 2012 at 18:17

2

Solved

I have a huge ammount of photos that need sorting through. I need to know the dimensions of each photo in order to know or it needs re-sizing. As a programmer I'm convinced there must be a quicker ...
Agentival asked 21/3, 2012 at 17:43

1

Solved

I want to check if file returned by readdir is directory. I tried do it using DT_DIR constant (as man readdir says) but it's undefined. What file should I include to get it? Now I use #include &...
Awl asked 11/2, 2012 at 15:49

3

Solved

I'm writing a program to step through a directory tree (Yes, I know about File::Find, but I'm writing a replacement). In my program, I'm doing a readdir on a whole directory and placing it in a l...
Telluric asked 12/12, 2011 at 19:44

2

Solved

i came across few articles about performance and readdir here is the php script: function getDirectory( $path = '.', $level = 0 ) { $ignore = array( 'cgi-bin', '.', '..' ); $dh = @opendir( $pat...
Outofdoors asked 30/11, 2011 at 1:35

2

Solved

This is a C program I wrote to recursively navigate and output directories and regular files. It compiles and runs fine on my Linux machine. But on Solaris, the dit->d_type == 8 check and the ot...
Cavalla asked 14/2, 2011 at 6:28

1

Solved

we are receiving about 10000 messages per hour. We store them as individual files in hourly directories on an ext3 filesystem. The file name includes a sequence number. We use rsync to mirror these...
Gruelling asked 28/5, 2010 at 11:13

10

Solved

This question is a spin-off from this one. Some history: when I first learned Perl, I pretty much always used glob rather than opendir + readdir because I found it easier. Then later various posts ...
Vennieveno asked 1/10, 2009 at 22:15

© 2022 - 2024 — McMap. All rights reserved.