(Perl) Demonstrate Directory Path Functions
Demonstrates the path functions GetDirectoryName, GetExtension, GetFileName, and GetFileNameWithoutExtension.
use chilkat();
$fac = chilkat::CkFileAccess->new();
# Note: Chilkat accepts either forward slash or backslash chars as directory separators..
print $fac->getDirectoryName("/MyDir/MySubDir/myfile.ext") . "\r\n";
print $fac->getDirectoryName("/MyDir/MySubDir") . "\r\n";
print $fac->getDirectoryName("/MyDir/") . "\r\n";
print $fac->getDirectoryName("/MyDir") . "\r\n";
print $fac->getDirectoryName("/") . "\r\n";
print $fac->getExtension("C:/mydir.old/myfile.ext") . "\r\n";
print $fac->getExtension("C:/mydir.old/") . "\r\n";
print $fac->getFileName("C:/mydir/myfile.ext") . "\r\n";
print $fac->getFileName("C:/mydir/") . "\r\n";
print $fac->getFileNameWithoutExtension("C:/mydir/myfile.ext") . "\r\n";
print $fac->getFileNameWithoutExtension("C:/mydir/") . "\r\n";
print "---" . "\r\n";
|