Filename manipulation

Within an ITP/Server Script you can modify filenames and paths:

<full file name>[<path>,<extension>]

This operation assumes that <full file name> is a valid filename. The result of this operation will be a valid filename. The name itself will be the same as the name of <full file name>, but the path will be replaced by <path> and the extension by <extension>. When an empty string "" is specified the path or extension will be left blank. When <path> or <extension> are not specified, the path or extension of <full file name> is not changed. Note that only the names are manipulated not the files themselves. In other words by manipulating a file name the file itself is not moved on the file system nor is it converted from, say, a Microsoft Word document to a text document by changing the extension from doc to txt.

"c:\temp\test.doc"[,"ps"] gives "c:\temp\test.ps" 
The extension <doc> is replaced with <ps>. Note that this is not a conversion, it simply means that the one extension is replaced.

"c:\temp\test.doc"["c:\in",] gives "c:\in\test.doc"
In this example the path of the file is replaced with c:\in. Note the comma in ["c:\in",] it must be there. The extension can be left out, as is done here, but the comma (,) must be there.

"c:\in\a67348.doc"["c:\out","ps"] gives "c:\out\a67348.ps"
In this example the path is replaced and the extension is changed. Again this doesn't mean that the file is converted; the extension is just replaced.

"c:\temp\test.doc"["",] gives "\test.doc"

Note

"" is not the same as nothing: "" will strip the path or extension, nothing will do nothing.

In the context of the note above:

Expression

Result

Description

"c:\temp\test.doc" ["",]

"\test.doc"

path removed

"c:\temp\test.doc"[,""]

"c:\temp\test."

extension removed

"c:\temp\test.doc"[,]

"c:\temp\test.doc"

nothing happened

"c:\temp\test.doc"["",""]

"\test."

path removed and extension removed