In OS X, if you have this kind of popup when copy-pasting a folder with lots of subfolders in it:

OS X Finder Replace Folder Popup - large

A newer folder named “subfolder_name” already exists in this location. Do you want to replace it with the older one you’re copying?

It means that: The subfolder’s content is going to be replaced (delete the previous sub-folder and paste the new one) instead of being merged.1

This sounds obvious but even after years of using OS X (since 2010) I’ve always thought that the behaviour for this kind of action would be replacing the files but still merging the subfolder content instead of replacing it like how it would be done on Windows or Linux.

This no brainer behaviour could lead you to a dumb disaster like I did yesterday when I decided to “manually update WordPress on my localhost”:

  1. Downloaded the latest version of WordPress
  2. Unzipped it. Note that it had wp-content, wp-includes, and wp-admin sub-folders
  3. Copied all files and folders from the unzipped folder
  4. Paste ‘em all on localhost’s WordPress folder. Having the popup mentioned above appeared and without further thinking, clicking the replace button because I thought it’ll replace files but merging the sub-folders (like how it is done on Windows / Linux)
  5. All custom plugins and themes on the wp-content disappeared.

Damn.

After hours of googling and trying to resurrect the file using third party file saver apps, the replaced files and folders couldn’t be restored. It becomes tricky for the wp-content/uploads/ folder but luckily I have all of custom plugins and themes backup-ed on the private git repositories.

Lesson learned:

  1. Always have a backup
  2. Finder is even more unreliable.

  1. Sometimes, you’ll have popup which offer you options between merge or replace, but most of the time you’ll have this replace or stop options. 

Share Your Thought