This section of the forum is now closed; we are working on a new support model for WDL that we will share here shortly. For Cromwell-specific issues, see the Cromwell docs and post questions on Github.
This WDL function allows you to name an output file based on another filename, e.g. an input filename. Giving it a File will strip off the path and yield the filename alone (as a String). If you also give it a string as a secondary argument, the function will attempt to strip that string off the end of the filename and return whatever remains.
This is super convenient for stripping off a file extension and replacing it with something else, when you want to e.g. name a task's output file based on an input filename.
File input_file = "/Users/chris/input.bam" String base = basename(input_file)
Providing a suffix string:
File input_file = "/Users/chris/input.bam" String stripped = basename(input_file, ".bam")
input, which can then be combined with a new suffix string to produce the desired output filename.