(Chilkat2-Python) Demonstrate Directory Path Functions
Demonstrates the path functions GetDirectoryName, GetExtension, GetFileName, and GetFileNameWithoutExtension.
import chilkat2
fac = chilkat2.FileAccess()
# Note: Chilkat accepts either forward slash or backslash chars as directory separators..
print(fac.GetDirectoryName("/MyDir/MySubDir/myfile.ext"))
print(fac.GetDirectoryName("/MyDir/MySubDir"))
print(fac.GetDirectoryName("/MyDir/"))
print(fac.GetDirectoryName("/MyDir"))
print(fac.GetDirectoryName("/"))
print(fac.GetExtension("C:/mydir.old/myfile.ext"))
print(fac.GetExtension("C:/mydir.old/"))
print(fac.GetFileName("C:/mydir/myfile.ext"))
print(fac.GetFileName("C:/mydir/"))
print(fac.GetFileNameWithoutExtension("C:/mydir/myfile.ext"))
print(fac.GetFileNameWithoutExtension("C:/mydir/"))
print("---")
|