2 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i have two csv files (rates.csv, reference.csv) as below.
rates.csv contains Code, respective Zone details
rates.csv
----------
23,38Nhava
45,37NEWYORK
89,SHILANG
71,ROBACCA
reference.csv contains all Zone details
reference.csv
-------------
37Newyork
robacca
38Nhava... (5 Replies)
Discussion started by: p_satyambabu
5 Replies
2. Shell Programming and Scripting
Please help me to write the following script.
1) Input files will be in Test directory. (Test/YYYY/MM) folders (Ex: 1) 2010/ 01 2) 2011/05)
The file name will be Testfile1_6676543218_Axxxxxxyyyyyzzzzzzzzzzzzzzzzzz.pdf.gz
2) The compare file will be in /tmp directory. (/tmp/comparefile.txt). The... (6 Replies)
Discussion started by: mnjx
6 Replies
DIR(3) 1 DIR(3)
dir - Return an instance of the Directory class
SYNOPSIS
Directory dir (string $directory, [resource $context])
DESCRIPTION
A pseudo-object oriented mechanism for reading a directory. The given $directory is opened.
PARAMETERS
o $directory
- Directory to open
o $context
-
Note
Context support was added with PHP 5.0.0. For a description of contexts, refer to "Streams".
RETURN VALUES
Returns an instance of Directory, or NULL with wrong parameters, or FALSE in case of another error.
EXAMPLES
Example #1
dir(3) example
Please note the fashion in which Directory.read(3)'s return value is checked in the example below. We are explicitly testing
whether the return value is identical to (equal to and of the same type as - see Comparison Operators for more information) FALSE
since otherwise, any directory entry whose name evaluates to FALSE will stop the loop.
<?php
$d = dir("/etc/php5");
echo "Handle: " . $d->handle . "
";
echo "Path: " . $d->path . "
";
while (false !== ($entry = $d->read())) {
echo $entry."
";
}
$d->close();
?>
The above example will output something similar to:
Handle: Resource id #2
Path: /etc/php5
apache
cgi
cli
NOTES
Note
The order in which directory entries are returned by the read method is system-dependent.
PHP Documentation Group DIR(3)