(PowerShell) Demonstrate Directory Path Functions
Demonstrates the path functions GetDirectoryName, GetExtension, GetFileName, and GetFileNameWithoutExtension.
Add-Type -Path "C:\chilkat\ChilkatDotNet47-9.5.0-x64\ChilkatDotNet47.dll"
$fac = New-Object Chilkat.FileAccess
# Note: Chilkat accepts either forward slash or backslash chars as directory separators..
$($fac.GetDirectoryName("/MyDir/MySubDir/myfile.ext"))
$($fac.GetDirectoryName("/MyDir/MySubDir"))
$($fac.GetDirectoryName("/MyDir/"))
$($fac.GetDirectoryName("/MyDir"))
$($fac.GetDirectoryName("/"))
$($fac.GetExtension("C:/mydir.old/myfile.ext"))
$($fac.GetExtension("C:/mydir.old/"))
$($fac.GetFileName("C:/mydir/myfile.ext"))
$($fac.GetFileName("C:/mydir/"))
$($fac.GetFileNameWithoutExtension("C:/mydir/myfile.ext"))
$($fac.GetFileNameWithoutExtension("C:/mydir/"))
$("---")
|