aiida-core icon indicating copy to clipboard operation
aiida-core copied to clipboard

`CalcJob`: Extend `retrieve_list` syntax with `depth=None`

Open sphuber opened this issue 1 year ago • 1 comments

Fixes #5650

There is currently no way to retrieve files using glob patterns while maintaining the exact file hierarchy of the remote working directory. The only supported syntaxes are:

  • Single string: some/path/with/glob/*.txt
  • Three-element tuple: ('glob/*.txt', '.', 1)

For the former, the matched file will be retrieved without any subfolders. For the latter, the levels of nesting to be kept is indicated by the final depth integer, but it has to be specified and needs to be 0 or larger.

It would be far easier if one didn't have to specify the depth and the file hierarchy would be kept as is. This functionality is added, so it is now possible to specify

retrieve_list = [('some/*.txt', '.', None)]

which will copy the files matched by the glob with the exact same file hierarchy, creating the nested directories where needed.

sphuber avatar Sep 21 '22 20:09 sphuber

~~Will add documentation once decided on the new syntax.~~

Documentation is now added.

sphuber avatar Sep 21 '22 20:09 sphuber