How to Exclude Files and Directories from Backups in cPanel & WHM

This guide explains how to exclude specific files or directories from user backups in cPanel & WHM. You can exclude items globally for all accounts or locally for individual users. These exclusions apply to WHM‑generated backups and full website backups in cPanel.

cPanel backup excludecpbackup-exclude.confWHM backup configuration

~2 min read · Updated Feb 15, 2026

How to Exclude Files from Backups


Valid for versions 82 through the latest version


Version: 82
Last modified: April 17, 2023


Overview


You can exclude files or directories from backups in two ways:

  • Exclude items from all users’ backups (Global Exclude)
  • Exclude items from a specific user’s backups (Local Exclude)

Both global and local exclude files apply to:

  • Backups generated in WHM (WHM » Home » Backup)
  • The Download a Full Website Backup feature in cPanel (cPanel » Home » Files » Backup)

Important Notes:

  • Home Directory backups created in cPanel ignore exclude files.
  • Backups created using /scripts/pkgacct also ignore exclude files.
  • Exclude files only apply to content inside a user’s home directory.

Global Exclude File


To exclude files or directories from backups for all users, add the paths to:

/etc/cpbackup-exclude.conf

This file excludes paths relative to the directory from which the backup script runs.


Default global exclusions include:


*/.wysiwygPro_*
*/core.[0-9]
.MirrorSearch
.cpan
.cpanel/caches
.cpanel/datastore
.cpcpan
.sqmailattach
access-logs
public_ftp/.ftpquota

Local Exclude File


To exclude files or directories from a specific user’s backups, add the paths (relative to the user’s home directory) to:

/home/username/cpbackup-exclude.conf

If the file does not exist, create it:

touch /home/username/cpbackup-exclude.conf

Notes:

  • Paths must be relative to the user’s home directory.
  • If you specify a directory, all files inside it will be excluded.
  • Do not include leading or trailing slashes or periods.

Example


To exclude the directory /home/username/example/ and the file /home/username/dir/example.php, your exclude file should contain:


example
dir/example.php

Conclusion


Using global and local exclude files gives you precise control over what gets included in user backups. This is especially useful for excluding cache files, logs, temporary data, or large directories that do not need to be backed up.


Written & researched by Dr. Shahin Siami

Related Articles

How to Restore Your cPanel Account: A Complete Guide for New System Administrators

This guide explains how new system administrators can restore a cPanel account using WHM, transfer accounts and configurations between servers, and enable diagnostic logging for transfer and restore operations. It covers essential concepts such as WHM vs. cPanel, root access, backup handling, SFTP uploads, transfer methods, and advanced debugging tools.

Continue

آموزش کامل انتقال تمام اکانت‌های cPanel از یک سرور به سرور دیگر

این مقاله نحوه انتقال همه اکانت‌های cPanel، تنظیمات سرویس‌ها، گواهی‌های SSL و IP اصلی سرور را از یک سرور قدیمی (Source) به یک سرور جدید (Target) توضیح می‌دهد. شامل نصب سرور جدید، انتقال تنظیمات، انتقال اکانت‌ها، تغییر IP، تنظیم DNS و نصب مجدد SSL است.

Continue

How to Migrate a WordPress® Installation to a cPanel & WHM Server

This guide explains how to migrate a WordPress installation from a macOS-hosted environment to a cPanel & WHM server. It covers exporting the database, uploading WordPress files, creating and importing a MySQL database, updating URLs, configuring wp-config.php, fixing broken links, and finalizing the migration.

Continue

How to Manually Transfer an Account Between Servers in cPanel & WHM

This article explains how to manually transfer a cPanel account between servers when the account is too large for WHM’s automated transfer tools. It covers creating temporary directories, compressing public_html and log files, securely transferring data with SCP, and restoring the files on the destination server.

Continue

How to Manually Migrate Horde Calendars and Contacts to Roundcube in cPanel & WHM

This article explains how to manually migrate Horde calendars and contacts to Roundcube in cPanel & WHM version 108 through 118. It covers exporting Horde data, placing it in the correct directories, and importing it into Roundcube using built‑in plugins or manual import tools.

Continue

How to Manually Migrate Accounts to cPanel & WHM from Unsupported Control Panels

This article explains how experienced system administrators can manually migrate accounts from unsupported third‑party control panels to cPanel & WHM. It covers pre‑migration steps, installation requirements, file and directory transfers, database restoration, SSL migration, and post‑migration tasks.

Continue