in reply to get folder name only

If using a regexp...:

if( $string =~ m![/\\]([^/\\]+)$! ) { print $1, "\n"; }

This works as long as you're dealing only with paths where there isn't a trailing filename. And of course it would run amok if the path didn't start with either a / or a \, or if a directory name allowed embedded / or \ characters. :) caviet lector.


Dave