coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pair-wise file operation (copy, link)


From: Pádraig Brady
Subject: Re: Pair-wise file operation (copy, link)
Date: Sun, 25 Aug 2024 13:22:16 +0100
User-agent: Mozilla Thunderbird Beta

On 25/08/2024 12:39, Yair Lenga wrote:
Greetings!,

The 'cp' and 'ln' command provides the ability to perform 'bulk' operation,
by specifying multiple source files and a target destination. In
addition to convenience, this approach provides significant
performance benefits, compared with running multiple cp/ln commands, one
for each file.

One limit of the bulk approach is that the destination file name must match
the source files name. There are multiple cases where this assumption is
not true. Common example include copying of source files into a new
directory layout, or renaming of files that can not be expressed based on
rules.

One common solution is to use a scripting engine (Python, Perl, Node),
which can perform the operation without spinning a process per file. Simple
for basic operation (especially, bulk renames), but those tools do not have
the power/flexibility of cp,

My suggestion: Add '--pairs' option to those tools, which will allow the
tool to work on pairs of arguments, within the same invocation.

cp --pairs ... -- source1 dest1 source2 dest2 source3 dest3
mv --pairs ... -- source1 dest1 source2 dest2 source3 dest3

Hope that development team will consider adding this feature into future
release of cp/mv

An interesting proposal (for cp,ln,mv,install).
It is a bit of an edge case though, so I'm inclined to think
a performance only interface change is not worth it here?

thank you,
Pádraig



reply via email to

[Prev in Thread] Current Thread [Next in Thread]