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

Can I use PHP opendir() on a external URL?

Possible Duplicate: PHP - opendir on another server Something like this: opendir(http://super.cdn.com/running_order_image/sale/587/) The opendir is being used to check the contents of a Rackspace Cloud Files Akamai bucket. I am looping through a…
TheBlackBenzKid
  • 26,324
  • 41
  • 139
  • 209
2
votes
1 answer

How can I calculate opendir success or failure time?

I'm writing a framework to test the behaviour of the CernVM FS. Basically, I have a service that mounts a remote filesystem served over http and does it with automount as soon as the the user attempts to access to the configured mounting point. One…
Zagorax
  • 11,440
  • 8
  • 44
  • 56
2
votes
2 answers

PHP opendir issue

Why do I get this error even though the directory exists? it works fine if I target the parent directory, I tried using %20 instead of space too, and tried removing the last / but nothing works! Warning: opendir(/home/xxxx/user_files/users/xxxx/test…
CJT3
  • 2,788
  • 7
  • 30
  • 45
1
vote
1 answer

Read a path stored in a text file and use it in opendir of PHP

I want to store a path (pointing to a directory) in a text file and open the path when required in PHP. Here's what I have done, which is quite simple but doesn't really work. $dir = file_get_contents('./dir_file'); $dir_content =…
ToonZ
  • 135
  • 6
1
vote
3 answers

Can I manipulate a directory stream obtained with opendir()?

The function opendir() returns a pointer to a directory stream DIR *, which apparently is an opaque data type. The implementation is hidden. The libc manual states that you should not allocate a DIR object yourself and let the directory functions…
cschol
  • 12,799
  • 11
  • 66
  • 80
1
vote
1 answer

Order of entries in directory stream obtained with opendir()

Can any assumption be made on the order of entries in a directory stream obtained with the opendir() function? For example, are . and .. always the first two entries? What would cause the order to change?
cschol
  • 12,799
  • 11
  • 66
  • 80
1
vote
2 answers

about 20% of time opendir script fails. See example

Hit refresh several times and see sometimes I get "null". This script loops through a folder to get all mp3 files and randomly selects one. What am I doing wrong? Thanks if ($handle = opendir('../../hope/upload/php/files/')) { while (false !==…
Papa De Beau
  • 3,744
  • 18
  • 79
  • 137
1
vote
1 answer

How to get opendir point to my public folder with the relative path "/"

this is kind of odd question, i can't figure out how to use relative path /which will not be interpreted as my drive in my current computer. I'm trying to build a gallery manager for a web site. the path "/" normally points to my public folder…
black sensei
  • 6,528
  • 22
  • 109
  • 188
1
vote
3 answers

C Programming - passing variable argument to opendir

I'm trying to do this: const char *p = "/home/paul"; dp = opendir(*p); But that fails with the following error: passing argument 1 of 'opendir' makes pointer from integer without a cast I'm at a loss here, as far as I know what I'm attempting…
user985779
  • 51
  • 1
  • 2
  • 7
1
vote
2 answers

readdir returning empty array on second call

When I open a directory with opendir() and later call readdir() two times in a row, the latter returns an empty array. minimal_example.pl: #!/usr/bin/perl use strict; use warnings; use Data::Dumper qw(Dumper); opendir(my $DIRH, "/home") or die…
noah
  • 312
  • 2
  • 13
1
vote
1 answer

Glob and counter in php

I have this script which arranges my folders in some tags and takes only 4 items.. which is great! But I need it to take the items by the alphabet $counter = 0; $directory = opendir("albums/"); while (($item = readdir($directory)) !== false &&…
Elad
  • 75
  • 2
  • 10
1
vote
4 answers

readdir() includes an empty folder

I have this part of script that echos the folders in "albums" folder and arrange them by the alphabet, but for some reason it also includes an empty folder. $directory = opendir("albums/"); $items = array(); while($items[] = readdir($directory)) …
Elad
  • 75
  • 2
  • 10
1
vote
1 answer

SFTP Opendir failing when called via Function

I have a bunch of php pages that are running on a schedule that pull data from different SFTP sources, to try and minimise this as a temporary fix I am turning them into functions and having one page that calls each of them However, when converting…
MrSmudge
  • 46
  • 3
1
vote
1 answer

Calculate blocksize of files in nested directories in C

I have been trying to calculate total block size of files recursively in nested folders. My code manages to get the block size of the files in the first folder but fails to read the size of files in folders nested in the current folder. The files in…
noob_coder
  • 21
  • 6
1
vote
1 answer

Returning pointer to structure in socket programming

In one of my projects an opendir() call in a client program is intervened using LD_PRELOAD and sent to a file sever for its processing (I do some logging in the server before calling opendir()). Thus the call passes through a socket. Now how do I…
Lipika Deka
  • 3,774
  • 6
  • 43
  • 56