coreutils
[Top][All Lists]
Advanced

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

Pair-wise file operation (copy, link)


From: Yair Lenga
Subject: Pair-wise file operation (copy, link)
Date: Sun, 25 Aug 2024 07:39:04 -0400

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

Yair


reply via email to

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