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...
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());
...
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...
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...
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...
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 ...
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...
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...
6
I have the following code
<?php
if ($handle = opendir('C:/xampp/htdocs/movies')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo $file."<...
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...
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...
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(($...
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...
3
Solved
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 &...
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...
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...
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 ...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.