Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.7: A warning about Finder's 'Replace' feature System 10.7
If you have a folder that contains a file with the same name, and drag the file into the same location as the folder, the Finder may try to delete both items.

To reproduce this:
  • Create a folder on your Desktop named 'test.'
  • Create a file in that folder also named 'test.'
  • Move the file from the folder onto your Desktop.
  • Click 'Replace.'
Result: Both the folder and the file are deleted.

Do the same sequence, except choose 'Keep Both Files.' Same result.

[crarko adds: Okay, this one half worked when I tried it in 10.7.3. With 'Replace,' both file and folder were indeed deleted. I also tried it with other items remaining inside the folder, and in that case everything inside the folder was also deleted. A potential disaster.

In the 'Keep Both Files' case, the folder was untouched and the file was renamed to 'test copy' when I moved it and 'test 2' when I copied it.

In any event, it's worth knowing that some potentially dangerous behavior is present in this function so there are no nasty surprises.]
    •    
  • Currently 3.71 / 5
  You rated: 3 / 5 (7 votes cast)
 
[8,429 views]  

10.7: A warning about Finder's 'Replace' feature | 22 comments | Create New Account
Click here to return to the '10.7: A warning about Finder's 'Replace' feature' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.7: A warning about Finder's 'Replace' feature
Authored by: axcess99 on Feb 22, '12 07:42:52AM

Yep, a child (folder/file/etc) replacing its parent (ancestor folder) is a dangerous thing.
Though they could have made it "work" with using some temporary renaming to prevent collisions/deletions, I'm not particularly surprised in retrospect.



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: mkuron on Feb 22, '12 08:02:06AM
10.6.8 does not contain this bug, instead it displays a warning The folder “test” can’t be replaced by an item it contains., which in my opinion is perfectly acceptable behavior in such a situation and certainly preferrable over data loss.

[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: kevans on Feb 22, '12 08:09:02AM

Since different systems (or system versions) may not behave in the same way, I have always avoided trying to give the same name to a folder and an included file. This used to fail with a warning.



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: michelle_eris on Feb 22, '12 09:26:27AM

Following the instructions, I can't duplicate the problem. The file is simply moved to the desktop, but sometimes it winds up in the top left corner of he desktop. I'm running 10.7.3.



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: MalEbenSo on Feb 22, '12 09:58:26AM

I trust the original poster has raised this with Apple?
https://bugreport.apple.com/



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: nova20 on Feb 22, '12 10:38:01AM

I tested this in 10.7.3 and got the same result as crarko: 'replace' deleted both, while 'keep both files' reamed the file. I believe that the 'replace' behaviour is not just dangerous but a clear bug to be reported to Apple.
I also agree with kevans that it's good practice to avoid giving the same name to a folder and an included file or folder.



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: andre402 on Feb 22, '12 11:52:27AM

It's a dangerous behavior but I don't understand why it works - after all, a folder and a file are different kind of "files" and that's why you can create a pdf, jpg etc. in the same location with the same names.
Also, I could not replicate the issue. On Desktop, I created a folder 'test', saved a plain text file named 'test' in the folder, then moved the file to the Desktop and it works: file 'test' is moved from the folder to the desktop.

Maybe the file has to have no ending to replace the folder (made in command line with e.g. 'touch')? (my file was 'test.txt', with file ending hidden in Finder). Any comments on how to reproduce the issue?



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: arcticmac on Feb 22, '12 12:40:45PM

I hope you submitted a bug report about this...



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: slb on Feb 22, '12 01:39:44PM

Good news is it will not happen that way by end of summer :)



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: Sigma on Feb 22, '12 02:26:02PM

An important thing to note is that the file has to be called 'test' with no extension (when I deleted the extension on a png OS X simply hid the extension). I don't think most people spend much time with files that don't have extensions, but it is a good thing to be aware of. I'm getting the same behavior on 10.7.3



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: cashxx on Feb 22, '12 03:57:52PM

Was just coming in to say the same thing.....9 times out of 10 I would assume the file has an extension on it. And the chances of a file and folder being named the same thing are somewhat slim. Should be a rare occurrence.



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: negritude on Feb 22, '12 08:11:35PM

Yep. In general, the only files in OS X that don't have extensions, are folders. So in one weird way, you could look at this as expected behavior.

Just about every file has some kind of extension, which is simply hidden, but it's there.



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: rychdom on Feb 22, '12 04:01:57PM
Also of note:
  • Command-Z does not undo this action.
  • The file is not moved to the trash, but instantly deleted.


[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: negritude on Feb 22, '12 08:32:34PM

I just tested this, and got the same behavior described here:

http://reviews.cnet.com/8618-13727_7-57382756.html?assetTypeId=12&messageId=11997336

If I create a *folder* called test within folder test, and try to have the child replace the parent, it won't allow me to.

If I create a *file* called test within folder test, and try to have the child replace the parent, it allows me to do that.

Edited on Feb 22, '12 08:33:01PM by negritude



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: sd on Feb 23, '12 01:19:19AM

yes it alreay happened to me, with a binary download from newsgroups.
Folder called SuperFile.mov, and containing among otherthings SuperFile.mov, and boom when trying to move the file out of the folder, everything lost :(



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: agentx on Feb 23, '12 08:13:42AM

This is a bug and is sloppy of Apple. I am sure they will wriggle around and say it is a feature but that is BS.

We actually came across this with a client who saved a presentation over a folder and hit replace because they thought it was replacing a previous version of file. It wiped the folder and we had to restore from Crashplan backup. However those who are not doing hourly backups could have lost a days work potentially. ( we run backups only at 7.00pm for example at most sites)

Edited on Feb 23, '12 08:15:37AM by agentx



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: michelle_eris on Feb 23, '12 09:20:05AM

I can confirm that this happens only if the file doesn't have an extension. Also in the rare instance where the user has assigned an extension to the folder and the file has the same extension.



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: jde on Feb 23, '12 11:24:30AM

I just duplicated the bug on 10.7.3 Server [Case Sensitive]

The bug is not present when the file has an extension.



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: Dave Creek on Feb 23, '12 12:42:38PM

So.....Is there an easy way to find all of the folder and file same name pairs on my hard drive?



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: DeadeyeM on Feb 23, '12 04:57:34PM

Got the same problem, but when i copied the file to desktop and holding Option key then Replace i got a message "The operation can’t be completed because an unexpected error occurred (error code -8058)." and after that both files are gone.



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: alansky on Feb 24, '12 03:22:04PM

I cannot reproduce this bug on my machine (running 10.7.3). If I create a folder named "test" on the Desktop and drag a file named "test" to the same location, the two can happily coexist. If I drag a second file named "test" to the Desktop, OS X renames the second file "test copy". No files are deleted.



[ Reply to This | # ]
10.7: A warning about Finder's 'Replace' feature
Authored by: steventruong on Feb 28, '12 05:04:06PM

Have noticed this bug for awhile even before 10.7.3. Except this doesn't just apply to folders specifically. I first discovered this bug when copying a video file that share the same name as the folder it was held in.



[ Reply to This | # ]