getPathComponent(): Returns specified path component
Posted: 17 Aug 2012 21:35
Surprise
Handy. Thank you.
Example use:
I wonder if you want to hear improvement ideas?
Return an empty string if the level in question is not present.
Would help in case of such > issues (click)
Code: Select all
v11.40.0202 - 2012-08-17 20:58
+ Scripting got a new function.
Name: getPathComponent
Action: Returns the specified component of a path.
Syntax: getpathcomponent([path], [component])Handy. Thank you.
Example use:
Code: Select all
$A = "C:\Documents and Settings\Administrador\Meus documentos\XYplorer\Contas a receber.docx.bak";
msg "Orig: $A<crlf>path: " . getpathcomponent($A, path);
msg "Orig: $A<crlf>parent: " . getpathcomponent($A, parent);
msg "Orig: $A<crlf>file name: " . getpathcomponent($A, file);
msg "Orig: $A<crlf>file base: " . getpathcomponent($A, base);
msg "Orig: $A<crlf>file ext: " . getpathcomponent($A, ext);I wonder if you want to hear improvement ideas?
getpathcomponent([path] [, component] [, level] )
Component: The component to return; can be any of the following:
folder: one folder name from the path, specified by level
Level: only used for component "folder". Returns the n'th folder name from path.
Values are: 1 for the top folder, 2 for the second from top and so on.
Negative value will return folder name from the right. E.g. -1 returns parent folder name.Return an empty string if the level in question is not present.
Would help in case of such > issues (click)