bug-coreutils
[Top][All Lists]
Advanced

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

bug#36901: Enhance directory and file moves where target already exists


From: L A Walsh
Subject: bug#36901: Enhance directory and file moves where target already exists
Date: Fri, 02 Aug 2019 20:34:36 -0700
User-agent: Thunderbird

Reposting this, since I realize that fixing the target-exists cases
with a helpful algorithm could change or eliminate many cases
where where now the user gets an error instead.



On 2019/07/28 23:28, Assaf Gordon wrote:

>
>
>     $ mkdir A B B/A
>     $ touch A/bar B/A/foo
>     $ mv A B
>     mv: cannot move 'A' to 'B/A': Directory not empty
>
> And the reason (as you've found out) is that the target directory 'B/A'
> is not empty (has the 'foo' file in it).
> Had this been allowed, moving 'A' to 'B/A' would result in the 'foo'
> file disappearing.
>   
---
    Why must foo disappear?

    Microsoft Windows handles this situation by telling the user that
the target directory already exists and giving the option to *MERGE*
the directories.

    If you attempt to move a file into a directory that already contains
a file by the same name, it pops up another notice asking if you want
to replace the old with the new, keep it as it is (file won't be moved and
in this case, old directory would still exist with the unmoved files left
in it), or keep both with the new file getting a name variant (like
foo.exe -> foo_1.exe, keeping the extension the same so as to not mess
up the identity of the contents.

    But in all the cases, a file with a non-conflicting name wouldn't
disappear from the target.














reply via email to

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