Rename File to its Parent Folder Name

Rename a filename to its parent folder name

This sample task will demonstrate how Automate can rename a filename to its parent folder name.

The ExtractFilePath() function is used to extract the path from a filename.

ExtractFilePath returns the path part (including drive letter) from the filename. The path consists of all characters before the last directory separator character ('/' or '\'), including the directory separator itself. In case there is only a drive letter, that will be returned.

ExtractFilePath can be used against a literal string, i.e. %ExtractFilePath('c:\test1\test2\test3\test4.txt')% or a variable, i.e. %ExtractFilePath(AMTrigger.Filename)%.

Task Category:

Functions (Basic)