note 42211 deleted from class.dir by aidan
| From: | aidan@php.net | Date: | Sun, 05 Sep 2004 07:22:06 +0000 |
| Subject: | note 42211 deleted from class.dir by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76041@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster at php minus works dot de
----
The Problem to make a script crawling through Windows and Unix directories is that Windows unses
'\' or '\\' and Unix uses '/' as diretory seperator.
To make a script running an both platforms you can use the PHP internal constant PHP_OS :
<?php
if ( strpos( PHP_OS, 'WIN' ) !== FALSE )
{ $dir_seperator ='\\'; }
elseif ( strpos( PHP_OS, 'Linux' ) !== FALSE )
{ $dir_seperator ='/'; }
?>
And now you can use the variable $dir_seperator for your [ rekursive ] crawling through directories.