i'm making a script that walks through directories..
i have it going up through directories and reading fine, .. but the problem is coming back down.
../ is not an option in this script.
what i need to do is use regular expressions 'preg_replace()' to take off the last directory of the path string.
PHP Code:
<?
$path="./path/to/somwhere/";
// here i need a function to modify the path
// to be: ./path/to/
?>
a regular expression would do the trick, but i'm not sure how to approach matching the last part of the string.