GNOME Bugzilla – Bug 425980
Folder is overwritten with a file with the same name
Last modified: 2017-10-28 12:02:26 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-))) ..."
Confirming with 2.21.91.
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.
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.
-> future, for the operation rework planned for gsoc 2017
This has been fixed in the context of a duplicate report. *** This bug has been marked as a duplicate of bug 773671 ***