dirname
basename: fix for trailing slashes