Bob Proulx <[email protected]> wrote:
> Salvador wrote:
> > Salvador wrote:
> >> I want to request a feature for the Cp command that consist in
> >> renaming a file from the source when a file in the destination
> >> directory with the same name already exists. I am thought It could
> >> be something like: from file.jpg to file-1.jpg. This behavior
> >> already exists in Web browsers and file managers. Thanks.
> > Also, I know about the backup argument but it makes the file not
> > being possible to use by some programs without being renamed.
>
> As you say the feature already exists with 'cp --backup[=CONTROL]' and
> therefore you already have that behavior available to you. If I
> understand what you are saying then you are asking for it to be made
> the default behavior.
I think what he wants is for the backup mechanism to preserve an
existing suffix on the filename by inserting the versioning token
somewhere in the middle of the filename.
Salvador: That's a tricky proposition. How do you know _where_ to put
the token? Figure out a good algorithm for determining how to rename
each of these files, starting with the easiest case and moving on from
there. Note that while I picked a couple of these to monkeywrench your
specific example above, any similar system will be susceptible to
similar weaknesses.
somepic.jpeg
package_sources.tar.gz
document_part_1-1.odt
document_part_1-2.odt
Song no. 7.mp3
some.people.really.name.files.like.this
alsolikethis
--
There are problems in today's world that cannot be
solved by the level of thinking that created them.
-- Albert Einstein