opendir Questions

6

Solved

Which is faster between glob() and opendir(), for reading around 1-2K file(s)?
Reames asked 4/5, 2010 at 6:38

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

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

4

Solved

I am accepting the path through command line input. When I do dir=opendir(args[1]); it doesn' t enter the loop...i.e dir==null... How do I pass the command line input to dir pointer? void mai...
Toothbrush asked 24/8, 2010 at 6:58

2

I have tried: function random_pic($dir = '../myfolder') { $files = opendir($dir . '/*.*'); $file = array_rand($files); return $files[$file]; } This function works using glob() but not opendir...
Burnight asked 25/8, 2012 at 5:2

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

6

Solved

I would like to use opendir() to list only the folders in a particular folder (i.e. /www/site/). I would like to exclude files from the list as well at the '.' and '..' folders that appear on a lin...
Mccarley asked 27/6, 2011 at 19:23

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

5

Solved

I'm using opendir function to check if a directory exists. The problem is that I'm using it on a massive loop and it's inflating the ram used by my app. What is the best (fastest) way to check if ...
Preponderance asked 16/2, 2012 at 16:2

4

Solved

What should be done to get titles (eg abc.jpg) of images from a folder/directory using PHP and storing them in an array. For example: a[0] = 'ac.jpg' a[1] = 'zxy.gif' etc. I will be using the...
Sontag asked 7/12, 2011 at 11:43

3

Solved

opendir MYDIR, "$dir"; my @FILES = readdir MYDIR; closedir MYDIR; It appears that 99.9 % of the time the first two entries in the array are always “.” and “..”. Later logic in the script has i...
Ornery asked 16/4, 2010 at 15:41
1

© 2022 - 2024 — McMap. All rights reserved.