After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 425980 - Folder is overwritten with a file with the same name
Folder is overwritten with a file with the same name
Status: RESOLVED DUPLICATE of bug 773671
Product: nautilus
Classification: Core
Component: Cut Copy Paste Undo
3.22.x
Other Linux
: Normal major
: future
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-04-03 19:36 UTC by Sebastien Bacher
Modified: 2017-10-28 12:02 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastien Bacher 2007-04-03 19:36:31 UTC
The bug has been opened on https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/95854

"Binary package hint: nautilus

SUMMARY

If you copy a file with the same name ("Photos", no extension) to a folder which contains a folder ("~") with the same name ("Photos"), the folder "Photos" will be overwritten completely

This is how I lost all my photos (guys, DO backup!)
...
> I've just tested and I get a warning saying that the folder already exists
...
I admit - not well-written bug.

There is a warning. Unfortunately, the folder with rich contents WILL get replaced by a file if you accept.

Behaves differently on Mac OS X and Windows.
...
> What do you suggest?
...
Daniel, a couple of ideas:

1. Do not allow to overwrite a folder with a file

In Unix it is not possible anyway...

dhcp1k250:~/Desktop Andrei$ mkdir test
dhcp1k250:~/Desktop Andrei$ cd
dhcp1k250:~ Andrei$ touch test
dhcp1k250:~ Andrei$ cp test Desktop/
cp: cannot overwrite directory Desktop/test with non-directory test

Why does Nautilus overwrite the folder?

2. Give an explicit warning: "You are overwriting the folder @s with a file
@s. All the contents of the folder will be destroyed. Are you sure?"

It is somewhat Windows-like behaviour, but what the heck? It is data that is
being destroyed.

And please do not set Importance to Wishlist. I know at least three people
that lost some important stuff in this way. (This is a hard way to finally
to learn to backup 8-)))
..."
Comment 1 Cosimo Cecchi 2008-02-18 16:15:33 UTC
Confirming with 2.21.91.
Comment 2 Paweł Paprota 2008-04-15 21:06:30 UTC
Ouch, that must have been painful!

Currently there's a following warning:

A folder named "abc" already exists.  Do you want to replace it?

The folder already exists in "/home/ppawel/projects/nautilus/test".  Replacing it will remove all files in the folder.

I don't think this is either intuitive or desirable - replacing a directory with a file poses greater threat that value as a valid use case, therefore I would be for issuing an error similar to cp one.
Comment 3 Arnaud B. 2012-02-11 22:04:10 UTC
This bug isn’t resolved (3.2.1), and I think it is critical. The warning isn’t displayed if you checked "Apply to all files" one time; it should have at least one other warning.
Comment 4 Carlos Soriano 2016-12-05 10:54:27 UTC
-> future, for the operation rework planned for gsoc 2017
Comment 5 António Fernandes 2017-10-28 12:02:26 UTC
This has been fixed in the context of a duplicate report.

*** This bug has been marked as a duplicate of bug 773671 ***