FAQ Backups & Recovery

How to restore one file without restoring everything

One missing or broken file rarely needs a full restore — pull that single file out of the archive instead.

Updated 4 min read Beginner

A full restore is overkill for a single deleted or broken file — extract just that one file from a backup and upload it back on its own. Restoring an entire account over a working site to fix one file is slower than it needs to be, and it also throws away every other change made since that backup was taken.

If your control panel offers file-level restore

Some backup tools let you browse a past snapshot and pull out individual files or folders without touching anything else. If yours does, this is the quickest route: find the snapshot from before the file was lost, locate the file inside it, and restore just that item. Nothing else on the site is affected.

If you only have a full archive

Just as workable, only with an extra step first. Download the backup archive, or use the copy you already have, and extract the single file locally rather than restoring the whole thing to the server.

unzip backup.zip path/to/the/file.php -d ./restored/
# or, for a tar archive
tar -xzvf backup.tar.gz path/to/the/file.php -C ./restored/

Then upload just that extracted file to its original location over FTP or SFTP, overwriting the broken or missing one. The rest of the site is untouched throughout.

Check the file actually matches what you need

A file from an old backup can be an outdated version of something that has since been updated for a good reason — a security fix, a compatibility change, a bug fix. Before overwriting a current file with an old one, make sure you are not undoing a change you would rather keep. If in doubt, save a copy of the current file before you replace it, so you can compare or reverse the change.

When a single file will not be enough

If the missing file is one that a database row directly depends on — for example, code that a plugin's settings reference by an exact filename or version — restoring the file alone can leave the file and the database slightly out of step. Watch for that specifically after restoring a single file that belongs to an application rather than a plain upload, and test the affected feature rather than assuming the file was the whole story.

If you cannot locate the file in any backup, or several files are affected rather than one, a full restore is the more appropriate tool — see restoring a website from a backup. And if you are not sure a backup containing the file exists at all, downloading a full account backup covers where to look and how to check what a given backup actually contains before you rely on it.

Related reading