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
2
votes
1 answer

Error when i try to opendir

I am stuck on this piece of code. Maybe the cause is the accented characters inn the path, I don't know. The code that I'm using is below my $var2 = realpath('C:\Users\brmelovi\Script\backups'); $source1 = 'N:\NBS_AR\COLLECTION\1.0 Times\2.0…
2
votes
1 answer

opendir on ssh2 never stops

I need to fetch some files from the root directory of a distant server through ssh, the local machine uses php7. I've made this script:
OSdave
  • 8,538
  • 7
  • 45
  • 60
2
votes
4 answers

Perl program help on opendir and readdir

So I have a program that I want to clean some text files. The program asks for the user to enter the full pathway of a directory containing these text files. From there I want to read the files in the directory, print them to a new file (that is…
AlphaA
  • 113
  • 2
  • 9
2
votes
1 answer

The filename, directory name, or volume label syntax is incorrect. (code: 123)

I am getting: The filename, directory name, or volume label syntax is incorrect. (code: 123) I have below function: public static function countDirectoryFiles($dir){ $i = 0; if ( $handle = opendir($dir) ) { …
Always_a_learner
  • 4,585
  • 13
  • 63
  • 112
2
votes
1 answer

Valgrind 1017 calloc/memcopy of struct dirent OK, 1018th -- invalid read

All, I don't know what limit I have hit or whether this is an issue with valgrind, libc, or me, but I need to know if this is reproducible, and if so, where this issue lies. I've boiled the issue down to an MCVE producable on 2 of my AMD boxes.…
David C. Rankin
  • 81,885
  • 6
  • 58
  • 85
2
votes
1 answer

opendir will not accept string variable but will accept plain string

I cannot get this function to work, because for some reason opendir will not take buffer2 (declared as char buffer2[128]) as an argument properly. If I replace the variable with something like "." or "sample", it works perfectly. But doing it like…
Luca
  • 515
  • 5
  • 17
2
votes
1 answer

C opendir and readdir and inode

I have saved my program in a folder where there are 5 files. Now I want to print the files inode numbers. Here's my program: #include #include #include #include #include #include…
David
  • 3,055
  • 4
  • 30
  • 73
2
votes
2 answers

Reading directory contents from a client's computer - PHP

I want to recursively read contents of a folder chosen by client on my site. I have used opendir() and scandir() but they are unable to read directory contents from client's computer. Is there any way that I can read the file names from visitor's…
Gaurav Arora
  • 63
  • 1
  • 10
2
votes
2 answers

Error opening existing directory using opendir in c++

I am making use of opendir() as below to access a directory. DIR *dp; if((dp = opendir(dir.c_str())) == NULL) { cout << "Error(" << errno << ") opening " << dir << endl; return errno; } However, I keep getting the error below, even though…
Olivier
  • 1,981
  • 7
  • 24
  • 29
2
votes
0 answers

How to use opendir with credentials

I want to be able to connect to a distant folder based on user's input. The system has to be compatible with different sharing protocols so I can't just use FTP in every case (distant folders are not necessarily implementing FTP). Right now…
user3803848
  • 179
  • 1
  • 13
2
votes
2 answers

Printing off_t file size from dirent struct

All i want is to print the size of a file in bytes I am using DIR *d; struct dirent *dir; d= opendir(absolute_path); while((dir= readdir(d))!=NULL){ printf("%s\t %d\t %u\n",dir->d_name,dir->d_type,(int long long )dir->d_off); } The printing…
Antifa
  • 377
  • 1
  • 4
  • 14
2
votes
1 answer

What is the difference between having/not having a '/' at the end when defining a directory?

When referring to directories in PHP such as in the code below. index.php if ($handle = opendir('/path/to/images/directory')) { while (false !== ($fileName = readdir($handle))) { ... } closedir($handle); } The setup we can…
Michael
  • 4,282
  • 9
  • 55
  • 89
2
votes
1 answer

What is the single dot and double dots in the return value of function readdir() in php

I've been confused with the concept which descriped in php.net for the function is_dir(),it says Tells whether the given filename is a directory (1)It checks whether the given parameter is a directory or not,when I give it a path,it returns true…
user2556058
  • 311
  • 4
  • 9
2
votes
4 answers

CodeIgniter - List of files and folders using opendir

I'm fairly new to certain programming techniques. Very new to OOP and MVC in general. And I'm pretty sure this is my first StackOverflow question! I've just downloaded CodeIgniter and have a little project for myself. I have a list of files and…
Mike Lovely
  • 21
  • 1
  • 2
2
votes
1 answer

Return file directories in an array

I`m trying to create a function that reads a directory and returns all file's working directories in an array, but it is not working. I don`t know why the code doesn`t work, can you help me? $postsDirectory = "../posts/"; function listFiles() { …
1 2
3
17 18