Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

WordPress "Installation failed: Destination folder already exists.": find the folder, then install

Technical article
Hosting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

WordPress 6.7.1 prints "Installation failed: Destination folder already exists." when it is asked to install a plugin or theme into a folder that already exists and holds files. Either the plugin is already installed, or an old folder with no valid plugin header was left behind, so the Install Now button still appears. Look at what is in that folder before you install again. An empty folder does not trigger the error.

What the error means

The installer, WP_Upgrader::install_package(), works out the destination from the package: the package's single top-level folder, placed under the plugins directory (wp-content/plugins unless WP_PLUGIN_DIR moves it) or the themes directory. By default abort_if_destination_exists is true, and a normal plugin install passes clear_destination as false, so the destination is not cleared.

The code comment explains the branch: "If we're not clearing the destination folder and something exists there already, bail." The installer then lists the folder, and only a folder with something in it counts: "But first check to see if there are actually any files in the folder." If files are there it deletes the unpacked source and returns the error folder_exists with the text "Destination folder already exists."

The words "Installation failed: " in front come from the admin screen's JavaScript, Installation failed: %s, which wraps the installer's message when you click Install Now on a plugin card or a theme. The Upload Plugin screen behaves differently. Our own reading of the skin code: it prints "Destination folder already exists." followed by the folder path and, when the existing folder holds a valid plugin, a comparison of plugin name, version, author and required versions, and a "Replace current with uploaded" button. The generic "Plugin installation failed." line is hidden for any upload that ends in this error. If the existing folder holds a valid plugin, the screen also adds "This plugin is already installed."

Why Install Now is offered for a folder that exists

Before showing a button, WordPress asks install_plugin_install_status(). It checks whether WP_PLUGIN_DIR holds a directory named after the plugin's slug. If so, it asks get_plugins() for plugins in that directory. When that comes back empty, the status stays install and the button is shown, even though the folder is there.

The Plugin Handbook explains what makes a file a plugin: "At a minimum, a header comment must contain the Plugin Name:". Our own reading: a folder with no PHP file carrying that header is therefore not seen as an installed plugin, and is still not empty.

Likely causes

Cause What you see How to confirm
The plugin is already installed Not listed as installable on the card, or the upload comparison screen Plugins > Installed Plugins lists it
A leftover folder with no plugin header file, for example from a stopped install or a manual copy Install Now offered, then the error The folder exists and is not empty, and no PHP file in it has a Plugin Name: header
An uploaded zip whose top-level folder has the same name as an unrelated existing folder Comparison screen, or the folder path in the error The folder name inside the zip equals an existing folder
A theme folder of the same name The same message from Appearance > Themes The folder exists under the themes directory

Prove the cause before changing anything

All of these steps only read.

  1. Write down the exact message and where it appeared: a plugin card's Install Now, the Upload Plugin screen, or the Themes screen. On the Upload Plugin screen, write down the folder path printed after the sentence.
  2. Go to Plugins > Installed Plugins and search for the plugin's name. If it is listed, it is installed and the folder is its home.
  3. WP-CLI gives the same answer. The wp plugin is-installed page says "Returns exit code 0 when installed, 1 when uninstalled."
wp plugin is-installed example-plugin
echo $?
  1. Open the folder in your host's file manager or an SFTP client: wp-content/plugins/example-plugin/. Note how many files it holds, and open the main .php file to see whether it starts with a comment containing Plugin Name:. Do not change anything.
  2. For an uploaded zip, open the zip and read the name of its single top-level folder. It must not equal the name of a folder that belongs to a different plugin.

Fix

Choose the route that matches what you proved.

The plugin is already installed

Nothing needs installing, because the plugin is already there; it is managed from Installed Plugins like any other. If you meant to replace it with an uploaded zip, the upload comparison screen is WordPress's own route: it lists the current and uploaded plugin name, version, author and required versions, and offers "Replace current with uploaded". That button overwrites the installed plugin's files. Our own advice: before anyone uses it, copy the plugin folder as shown under "A leftover folder with no plugin header", because changes made to the installed files are lost.

A leftover folder with no plugin header

This route parks the old folder outside the plugins directory, then installs again. Run the commands from the WordPress root folder. The folders /home/example/saved and /home/example/parked must already exist outside the site's web root. Creating them is the server administrator's task and is not a step here.

First save the current state: copy the folder to /home/example/saved. POSIX cp with -R copies a file hierarchy and -p keeps the file times.

cp -pR wp-content/plugins/example-plugin /home/example/saved/example-plugin.2026-12-04

Risk: the next command moves the folder out of wp-content/plugins. Anything stored inside that folder, such as settings files, uploads or caches the plugin wrote there, leaves with it. If the folder held the only copy of a custom plugin, that plugin is gone from the site until the folder is moved back.

mv wp-content/plugins/example-plugin /home/example/parked/example-plugin

To undo it, only if you change your mind before installing the replacement: move the parked folder back. The saved copy example-plugin.2026-12-04 holds the same files.

Risk: the next command puts the old folder back at wp-content/plugins/example-plugin. If a new install has already created a folder of that name, the command would place the old folder inside it.

mv /home/example/parked/example-plugin wp-content/plugins/example-plugin

Then open Plugins > Installed Plugins and check that the plugin list is as it was before.

Only if you are not backing out, install the plugin again.

Risk: Install Now writes a new folder wp-content/plugins/example-plugin on the live site. This step cannot be undone: once that folder exists, the back-out above no longer applies, because the old folder would be moved inside the new one.

Go to Plugins > Add New, find the plugin and click Install Now.

The uploaded zip has the wrong top-level folder name

Our own advice: obtain the package from the plugin's own download page so that its folder name is the plugin's own, rather than renaming files to get around the message. Where the existing folder belongs to an unrelated plugin, the comparison screen shows its name and author, which tells you which of the two is which.

A theme folder

The installer code is the same for themes, and the same message appears from Appearance > Themes. The themes directory is the place to look for the folder of that name.

Example (illustrative): on web01, an administrator clicks Install Now for example-plugin on www.example.com and gets "Installation failed: Destination folder already exists." Installed Plugins does not list it. In SFTP, wp-content/plugins/example-plugin/ holds three files and none of them has a Plugin Name: header. The administrator copies the folder to /home/example/saved/example-plugin.2026-12-04, moves it to /home/example/parked/example-plugin, clicks Install Now again, and the install completes.

Confirm the fix

  1. The Install Now click ends with a success message and an Activate button instead of the failure.
  2. The plugin appears under Plugins > Installed Plugins, and wp plugin is-installed example-plugin followed by echo $? prints 0.
  3. Activate it only when you are ready. The parked folder can then be kept or removed under your own retention rules.

What to watch afterwards

Risks and limits

  • These commands have not been run or lab-tested.
  • The messages and checks come from WordPress 6.7.1. Other versions may word them differently.
  • The paths in the commands are examples. Use the real paths of your site, and keep the saved and parked folders outside the web root.
  • A folder moved out of the plugins directory is a change to the live site. Do it outside busy hours.

Sources