selecting a file/dir from directory listing with symlinking
See original GitHub issueExpected Behavior
In an ExpressionTool and when selecting a file or subdirectory from an input directory, I want this file not to be copied but rather symlinked.
Is there a way to do that ?
This feature would be really useful when files are big. Especially when, in a workflow the expressionTool output is an intermediary file which is not kept in final output.
Actual Behavior
I did not find any way to implement the behavior I am looking for. The selected file is copied in my workflows. Below an example of an expressionTool to select a file from a directory.
Workflow Code
cwlVersion: v1.0
class: ExpressionTool
id: fileFromDir
requirements:
InlineJavascriptRequirement: {}
inputs:
dir:
type: Directory
prefix:
type: string
default: ''
basename:
type: string
suffix:
type: string
outputs:
xfile:
type: 'File'
expression: >
${
var targetFileName=inputs.prefix+inputs.basename+inputs.suffix;
for (var i in inputs.dir.listing){
var itemFile=inputs.dir.listing[i];
if (itemFile.basename == targetFileName){
var targetFile=itemFile;
break;
}
}
return {'xfile':targetFile};
}
Your Environment
- cwltool version: 3.0.20200709181526
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Recursively List All Files in a Directory Including Symlinks
In this short tutorial, we'll see how to follow symlinks when listing recursively all files in a directory. To do that, we can...
Read more >thoroughly find all links (hard and symlinks, and any ...
I want, only using "basic" commands (for maximum portability) (i.e., something that would work on AIX / Linux / etc., not just something...
Read more >Get names of all files from a folder with Ruby - Stack Overflow
and if you want to find all Ruby files in any folder or sub-folder: ... Dir.entries("your/folder").select { |f| File.file?
Read more >Symlink Tutorial in Linux β How to Create and Remove a ...
A symlink (also called a symbolic link) is a type of file in Linux that points to another file or a folder on...
Read more >Node.js fs.symlink() Function - GeeksforGeeks
type: It is a string which represents the type of symlink to be created. It can be specified with 'file', 'dir' or 'junction'....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you very much for your reactivity.
My bad, everything is fine with this implementation in cwltool.
Since the problem I had related to #888 I have temporarely replaced
cwltool
cmdline withtoil-cwl-runner
.Using cwltool and while keeping temporary file we ccan see that everything is fine:
The file
hello1.txt
is not copied; nor incache
nor intmp
.However the problem stands with
toil-cwl-runner
:The problem is that the
hello1.txt
file is copied in the temporary directory (jobstore)cache/test/files/for-job/kind-file_home_users_jfouret_toil_test_file-picker-wf.cwl_first_20f90064-e089-49f8-b671-2b61809f0bf9/instance-wqh50svk/file-c7rkl6um/hello1.txt
rather than being symlinked.I did not see that #888 had been fixed. I will try it.
I am going to create an issue for toil and reference this post.
Thanks,
Thank you @jfouret for the update and your persistence! Iβll close this issue for now. I hope the fix for #888 works for you π