Exercise: basename/dirname
Create two functions basename()
and dirname()
Given a path such as /home/foo/.mozilla/cache/data.txt
the basename()
function should return the filename ( data.txt in the example).
The dirname()
function should return the full-path directory name
( /home/foo/.mozilla/cache
in the example.)