Wiki source for CommandXfile


Show raw source

======Command xfile======

====Name====
**xfile** file name manipulations



====Synopsis====
xfile [ [[SerializationOptions serialization options]] ] [options] [filename [base]]

====Options====

||-b,-base|| basename of file without directory or extension ||
||-B,-basename||basename of file with directory but without extension||
||-n,-name|| name of file without directory ||
||-N|| exactly as given, including directory if present but converted to java format||
||-d,-dir|| Directory component ||
||-a,-absolute|| absolute path||
||-c,-canonical||canonical path||
||-e,-extension||extension only including the "." ||
||-u,-uri||outputs a file scheme URI ||
||-s,-sys||Converts the filename to local system notation otherwise outputs Java notation||
||-r,-relative||Path relative to current directory||


Supports the standard [ [[SerializationOptions serialization options]] ]

If [filename] is omitted the current directory is used
if [base] is provided then it is added as a new component to the filename prior to executing the options
If [base] is an absolute path (on windows this means a drive letter or UNC path, on unix starting with /) then
filename is ignored. This allows xfile to be used to conditionally resolve relative paths.




====Description====
Prints a component of a filename or path.

Example:
%%(shell)
xfile -a foo.bar
%%
Result
%%
c:/work/dei/xmlsh/trunk/foo.bar
%%

%%
xfile -e $PWD/foo.bar
%%
Result
%%
.bar
%%

Resolve a relative path
%%
xfile /tmp foo/bar
%%
Result
%%
/tmp/foo/bar
%%

Resolve a absolute path on windows
%%
xfile /tmp c:/foo/bar
%%

Result
%%
c:/foo/bar
%%


====Windows Notes====
On Windows systems, the output filename is converted to the Java notation unless the -s argument is given. This changes \ to / but preserves any drive letter.


====Return Value====
Returns 0 if the command executed successfully, 1 if there was an error.
----
[[Commands]]
[[CategoryCommands]]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki