coreutils
[Top][All Lists]
Advanced

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

Re: Feature request for cp


From: Dragan Simic
Subject: Re: Feature request for cp
Date: Tue, 11 Jul 2023 17:39:32 +0200

On 2023-07-11 16:29, Tommy Bollman wrote:
Hello guys.

Feature request.

I have made a little command line cp utility *nrcp*, that basically takes a file name as an argument and appends an ascending number at the end of it.

The intention is to be able to keep backups for back tracking during
experimenting with files.

Wouldn't it be better to simply use some of the commonly available version control systems for that purpose? See, having a single file versioned through IDs in its filename is admittedly rather neat, but the things quickly become
rather complicated when it gets to directories with multiple files, etc.

The "cp" utility would have to be able to deal with all that, which would quickly get out of hand and turn it into yet another version control system.

I honed the idea further, and I added a **-k** switch, that preserves the
file mode, so that I can just "nrcp -k shellscript"  which returns a
shellscript.0 that is still executable, but I can edit it at my hearts
contents, without ruining the real one.

While at that feature, I figured I could also embed the number, which is much more practical if I work on a c-file, or any other file-type where the
extension matters. And I implemented that in the -k switch, so it both
preserves file mode, and embeds the number inside any extension.

Honestly, I'd rather see the utility in the **moreutils** packaged, but it is without maintainer at the moment. And I am being nagged for not trying to get you to implement this into core-utils, as it IS a SUPER-PRACTICAL
feature. :)

I see that cp doesn't do anything with the **-k** nor **-K** switches, so I
humbly propose those for invoking the behavior in cp.

The whole discussion has been in this reddit thread:

<
https://www.reddit.com/r/commandline/comments/14vptm6/a_little_tool_that_creates_a_numbered_copy_of_a/


The code for the utility resides in this gist:
<https://gist.github.com/McUsr/74e277ff8bd4707f151cf73eae8e20c4>

I hope to hear from you, whether the message be positive or negative!

And I am happy for GNU existing!

Keep up the good work and have a wonderful rest of the summer!

Sincerely

Tommy Bollman/McUsr.



reply via email to

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