Skip to content

Commit ee88157

Browse files
stilley2pndni-builder
authored andcommitted
Add "copy" trait to Rename, to allow copying instead of symlink
1 parent f7d7a1c commit ee88157

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

nipype/interfaces/utility/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ class RenameInputSpec(DynamicTraitedSpec):
213213
"replacement inputs")
214214
use_fullpath = traits.Bool(
215215
False, usedefault=True, desc="Use full path as input to regex parser")
216+
copy = traits.Bool(False, usedefault=True, desc="Whether to copy the file "
217+
"(True) or try to symlink it (False)")
216218

217219

218220
class RenameOutputSpec(TraitedSpec):
@@ -301,7 +303,7 @@ def _rename(self):
301303
def _run_interface(self, runtime):
302304
runtime.returncode = 0
303305
out_file = os.path.join(runtime.cwd, self._rename())
304-
_ = copyfile(self.inputs.in_file, out_file)
306+
_ = copyfile(self.inputs.in_file, out_file, copy=self.inputs.copy)
305307
self._results['out_file'] = out_file
306308
return runtime
307309

0 commit comments

Comments
 (0)