Technology Insights

Exclude Multiple Directories When Creating A tar Archive

Earlier when upgrading a WordPress site that is running on a CentOS Linux server I needed to quickly backup the entire site to then perform an upgrade of the core WordPress installation. There are multiple directories located beneath the primary site folder that I didn’t need to backup including some caching directories as well as a database backup directory since all of those directories are not required to restore the site in case of an issue during the WP upgrade. Use the information below to create a tar archive while excluding multiple sub directories.