readdir

Linux ext3 readdir and concurrent updates

Dear all, we are receiving about 10000 messages per hour. We store them as individual files in hourly directories on an ext3 filesystem. The file name includes a sequence number. We use rsync to mirror these files every 20 seconds at another location (via a SAN, but that doesn't matter). Sometimes an rsync run picks up files n-3, n-2, ...

Sorting a directory in perl, taking numbers into account

I think I need some sort of Schwartzian Transform to get this working, but I'm having trouble figuring it out, as perl isn't my strongest language. I have a directory with contents as such: album1.htm album2.htm album3.htm .... album99.htm album100.htm I'm trying to get the album with the highest number from this directory (in this c...

PHP: readdir to scandir?

i wonder how i can transform exactly the following piece of code to scandir instead of readdir? $path = 'files'; //shuffle files $count = 0; if ($handle = opendir($path)) { $retval = array(); while (false !== ($file = readdir($handle))) { $ext = pathinfo($file, PATHINFO_EXTENSION); if ($file != '.' && $file != '...

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] read dir error (readdir(): supplied argument is not a valid Directory resource )

hello, tryin to read dir content with readdir($myDirectory), but i getting error: readdir(): supplied argument is not a valid Directory resource i checked with is_dir($myDirectory) is it directory or not, and yes, it is directory. so, why i can not read dir? is it permissions problem? just to mention, it's all on win xp box, not l...

PHP / read txt files (or anything)

Heya all.. I've been searching for a while now, but php-noob as I am, can't get it to work. What I'm trying to accomplish is a way to make directories in your root, with in each of them images + a txt file. So let's say you got: Root | +---Directory 1 | | | +---Image1.jpg | | | +---Image2.jpg | | | +---Text.txt |...

how do I exclude non-folders files from this readdir function?

The following lists the folders, the index.php and the favicon.ico in the directory. I want to see only folders. Any ideas? Thanks. <?php // opens this directory $myDirectory = opendir("."); // gets each entry while($entryName = readdir($myDirectory)) { $dirArray[] = $entryName; } // closes di...

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 ...