applescript - extract filename from posix path
Try this:

set yourpath to ("/YOUR/PATH/HERE/file.ext") as POSIX file
do shell script "basename " &amp; quoted form of POSIX path of yourpath


This should work for files and folders as well. 
I used "basename " &amp; quoted form of... because AppleScript and shell script handle spaces in directories quite in a different way, that should allow you to use also paths with spaces in it.