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

How to read multiple files from directory and run the script on each file

I'm having difficulty with this problem. I have created a PHP script that pulls data from a .mov file, parses it, and then outputs only the data that I want. Now, my problem is that I have to do this for 80+ files, and I was wondering how can I read…
ValleyDigital
  • 1,460
  • 4
  • 21
  • 37
0
votes
3 answers

Displaying opendir results in a select list alphabetically

I'm populating a select element with the following :
Grant
  • 1,297
  • 2
  • 16
  • 39
0
votes
2 answers

How to loop all folders and open it, read file put \n on the end of each line and make it a single line and save it as a new file

I have a directory that contains a lot of folders only and each of those folder has a text file that contain urls what Im trying to do is to create a php code that will open that text file on each that folder and will edit that and make that urls in…
denzuko
  • 1
  • 1
0
votes
1 answer

PHP opendir() failing in IIS

I have a PHP script that is trying to open the directory "C:\Users\userA\Desktop". However, the opendir() call is returning false. Here is my code: $path = 'C:\Users\userA\Desktop'; var_dump (is_dir($path)); //prints TRUE var_dump…
scott80109
  • 361
  • 6
  • 25
0
votes
1 answer

Easy way to sort getting images from a gallery using php?

Hello there good people of stackoverflow. I have this code that basically get any photo i place in a folder called "pictures" and displays them on my page. Which is all good, and it works, with lightbox as well. My main question is, can there be an…
Sean Kerwin
  • 89
  • 1
  • 1
  • 9
0
votes
2 answers

php get description from opendir

This php code uses opendir() to display an array of files in the folder. Question: This code works as it is, but what i would like to do is display the description of the file as well. I have added $description to the url in the code: $result .=…
Daisy Oopsy
  • 155
  • 9
0
votes
7 answers

opendir array exclude file from results

The code below will select all of my php files from the named folder and then shuffle them and echo 10 results on my page, the folder contains an index.php file which i would like to be excluded from the results.
Daisy Oopsy
  • 155
  • 9
0
votes
1 answer

Changing the names of images within a directory and displaying the changed file names

The purpose of the script is to change the names of of a list of images within a directory for an ecommerce site. So specifically when the script is rand a user will type in a word or phrase that they would like a set or list of files to be prefixed…
codename32
  • 171
  • 1
  • 9
0
votes
2 answers

Find file in a directory using preg_match?

I need to find a file in a directory that matches a certain condition. For example, I know the file name starts with '123-', and ends with .txt, but I have no idea what is in between the two. I've started the code to get the files in a directory and…
Cofey
  • 11,144
  • 16
  • 52
  • 74
0
votes
2 answers

Reading a Wordpress Directory With PHP

I am in the process of writing a Wordpress plugin, and I'm having an issue reading the files in a directory. This script works fine outside of wordpress, and I'm not sure what the issue is. $thumbPath = '../wp-content/uploads/images/thumbs';…
Kendra
  • 116
  • 2
  • 13
0
votes
1 answer

I cant open a dir using php opendir

I have code as below: $dir = opendir("D:/Marcin"); if ($dir) { echo "OK"; } else { echo "not ok"; } and I get not ok, why??
Marcin Kostrzewa
  • 565
  • 4
  • 11
  • 24
0
votes
1 answer

What is the correct format for a directory path when using PHP's opendir()?

I'm having trouble with my filepath when using opendir(). I get the following warning: PHP Warning: opendir(/uploads/users/405/images/profile/profilepic/) [function.opendir]: failed to open dir: No such file or directory in …
Aaron Brokmeier
  • 41
  • 1
  • 2
  • 8
0
votes
1 answer

How to read the contents of a directory during a custom system call in Linux kernel 3.2.x

I'm trying to open a directory during a custom system call in the Linux kernel (3.2.17) using openDir: #include #include #include // also tried "asm/types.h" #include #include…
Rob
  • 788
  • 8
  • 9
0
votes
1 answer

Scandir Array display without file extensions

I'm using the following to create a list of my files in the 'html/' and link path. When I view the array it shows, for example, my_file_name.php How do I make it so the array only shows the filename and not the extension? $path =…
0
votes
2 answers

relative addressing in perl ,using open dir

I have the following code for listing all files in a directory , I have trouble with path addressing ,my directory is is */tmp/* ,basically I want the files which are in a directory in tmp directory.but I am not allowed to use * ,do you have any…
shaq
  • 799
  • 1
  • 7
  • 12