Filesystem Functions
Filesystem functions are used when you work with files to pass configuration values or read the input content and so on. This is very helpful in real-life scenarios such as processing upstream files via automation or creating files to be passed to downstream systems with custom content and encoding. The examples used in the section will be available with the filename 6. filesystem-functions.txt
in the GitHub link provided at the start of this chapter.
Function outputs for the examples in this section will be based on Windows OS but similar outputs can be expected if you use a different operating system.
For the following examples, create a file with the name test.txt
with the content as testfile
before trying out these functions.
The abspath() Function
The abspath()
function will convert the string with the file path to an absolute path.
Here is an example:
$ abspath("/terraform")
"C:/terraform"