opendir

How does opendir work in Perl 6?

Hello! Can someone tell me, why the "opendir" doesn't work? #!/usr/bin/env perl6 use v6; my $file = 'Dokumente/test_file'; if ( my $fh = open $file, :r ) { for $fh.lines -> $line { say $line; } } else { say "Could not open '$file'"; } my $dir = 'Dokumente'; my $dh = opendir $dir err die "Could not open $dir: $!"; ...

Can't open directory, or what's wrong with my (Perl) code?

Hi all, I have a file name logspath.txt which contain on the logs directory path on the machine. one directory each line. Although the directory exist, Perl say it doesn't. #!/usr/bin/perl -w open FILE,"logspath.txt" or die $!; while (<FILE>){ print $_; opendir ($DIR,chomp($_)) or die $!; When I'm running the script I get: /h...

Should Perl's opendir always return . and .. first?

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 issues if it is not true. I ran into a case where the directory entries appeared later. Is this indicative of the file system being cor...

Which is faster: glob() or opendir()

Which is faster between glob() and opendir(), for reading around 1-2K file(s)? ...

"Copy failed: File too large" error in perl

Ok so i have 6.5 Million images in a folder and I need to get them moved asap. I will be moving them into their own folder structure but first I must get them moved off this server. I tried rsync and cp and all sorts of other tools but they always end up erroring out. So i wrote a perl script to pull the information in a more direct met...

Implementing Open Directory on Mac OS X Server and Directory binding

We are using Open Directory on a Mac OS X Server 10.6. Our goal is to enforce password changes for users which can easily be done through Open Directory. However, we must first bind the clients to the Open Directory server. The issue we are running into is that most the the user accounts on the clients match the account on Open Directo...

Can you list files in a directory with JavaScript but without ActiveX?

I wrote a script in php that allows me to get a list of files in a directory as an array, parse each one for a particular string, and then it displays all of the files that contain the search string. My IT staff won't let me install php on the server though. Can this be done with javascript without ActiveX? Everything I could find on th...

PHP List Images In Folder

I have the following code // Define the full path to your folder from root $path = "../galleries/".$album; // Open the folder $dir_handle = @opendir($path) or die("Unable to open $path"); // Loop through the files while ($file = readdir($dir_handle)) { if(strlen($file)>1){echo "<a href='htt...

How to list all of the files in a directory and its subdirectories with php

I'm attempting to use a sample function on the PHP manual website (posted by a user). The function is supposed to return a nested array of all of the files and/or folders in a specified directory of your server. I'm just learning php, so I think it's more likely that I'm doing something wrong, and less likely that the function doesn't ...

Mac OS Server Login/Logout Script not working

Hi Guys, I implemented a magic triangle consisting of an Active Directory along with a Mac OS X server Open Directory. I am trying to implement login and logout scipts via workgroup manager in OD for Active directory users. Other settings like SIMPLE FINDER work fine which confirms that the setup is correct. I have already enabled the...

Accessing Directories in C

The program is to open a directory and to display the name of the files... i.e if there is a file..it should say FILE....else DIRECTORY.. but the program displays all the files as directory.. Could anyone pls check the code for any errors....thnx #include<stdio.h> #include<dirent.h> #define DIR_path "root/test" main() { DIR...

Open directory using C

i am accepting the path through command line input. when i do dir=opendir(args[1]); it doesnt enter the loop...i.e dir==null... how do i pass the commandline input to dir pointer??? void main(int c,char **args) { DIR *dir; struct dirent *dent; char buffer[50]; strcpy(buffer, args[1]); dir = opendir(buffer); //t...

PHP: Why is readdir working for me at command line but not browser?

I have 2 folders: /var/www/vhosts/mydomain.com/httpdocs/ and /var/www/vhosts/mydomain.com/httpdocs/duh/ Both folders have the EXACT same perms, group, owner, everything. If I set $path to the first one, no problems, I echo a list of files with 'html' in the filename. If I set $path to the second one, it dies on the opendir(). However,...

Create a select dropdown from file tree of images & sub directories using PHP

I'm creating a wordpress meta box and I need to scan a directory of subdirectories containing images within my template and add these to a select dropdown so I can use the filename in my template. The images are currently arranged in the folder like this: Parent Folder |_ Secondary Folder    |_ Image.png    |_ Image.jpg    |_ Image.gi...

How can I list all files in a directory sorted alphabetically using PHP?

I'm using the following PHP code to list all files and folders under the current directory: <?php $dirname = "."; $dir = opendir($dirname); ?> <?php while(false != ($file = readdir($dir))) { if(($file != ".") and ($file != "..") and ($file != "index.php")) { echo("<a href='$file'>$file</a> <br />"); } } ?> The problem is list is not ...