s.getpath([file] [append]) s.getfilename([file] [ext])
s - str variable.
file - full path to file or folder. Default: s.
append - some string (e.g., another filename) to append. Use "" to prevent appending "\".
ext - if nonzero, get filename with extension.
getpath extracts the path part from file.
getfilename extracts the filename part from file.
There are many easy to use Windows API functions that can be used to work with paths and URLs. For example, PathFindExtension finds file extension. They are documented in MSDN Library.
str s1.getpath("c:\folder\test.txt") str s2.getfilename("c:\folder\test.txt") str s3.getfilename("c:\folder\test.txt" 1) now s1 is "c:\folder\", s2 is "test", s3 is "test.txt"