Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to exclude specific files/directories from a backup in Plesk?
Answer
In order to exclude files from backup click to expand on the section
-
Go to Domains > example.com > Backup Manager > Back Up and use Exclude specific files
-
Only paths relative to the subscription can be used. For example:
CONFIG_TEXT: httpdocs/images/file.jpg
To exclude all files in the directory, use '*' mask, for example:
CONFIG_TEXT: httpdocs/images/*
To exclude a whole directory, specify the name of the directory, for example:
CONFIG_TEXT: httpdocs/images
Note: when excluding specific files from Full Server backup all files specified in Exclude specific files from the backup option on all domains will be excluded. It is not possible exclude specific file from specific domain only. Vote to implement features on Plesk User Voice Portal.
-
In Tools & Settings > Backup Manager > Back Up and use Exclude specific files from the backup option:
-
Only paths relative to the subscription should be used. For example:
CONFIG_TEXT: httpdocs/images/file.jpg
To exclude all files in the directory, use '*' mask, for example:
CONFIG_TEXT: httpdocs/images/*
To exclude a whole directory, specify name of the directory, for example:
CONFIG_TEXT: httpdocs/images
Comments
39 comments
or
Too, the trailing wildcard is mandatory?
Hello Marco,
Please use relative paths only (means that values should not begin with "/"). As for asterisk symbol, it is mandatory if you want to exclude all files in a specific directory, otherwise, it will not work without *.
So, please correct the description of option "Exclude specific files from the backup" in Plesk UI because it says to use the leading slash:
"You can only exclude files within webspaces. Specify the path or paths relative to the webspace root, separating individual files with commas. Using the mask symbol is allowed (e.g. /somedir/log*)."
@Marco Marsala I double checked it on my test and it works in both ways: with leading slash and without it. Relative path should be specified inside webspace directory(e.g. /var/www/example.com/) For example, there is some subdirectory like /var/www/example/subdir/ and it is required to exclude the files inside of this subdirectory, the path you have to specify during backup creation is /subdir/* (or subdir/*)
The article has been update with additional details.
Will
exclude files and folders in
?
Sorry but I'm doubt about the syntax.
Marco,
I you'd like to exclude all files from all cahce dirrectories, you can use the following regexp:
CONFIG_TEXT: **/cache/**
and here is come technical exaplanation:
*
in the end of string transforms into.*
*
in all other places transforms into[^/]*
**
in all places transforms into.*
how to exclude folder from backup and all sub-folders
I want to exclude "/domain.tld/httpdocs/folder1/sub1/sub2/sub3/sub4/sub5"
how can I exclude all 5 subfolders without writing 5 different rules?
it is especially important, because folders are dynamically created with random names, so it is impossible to think ahead
Pera,
To exclude all subfolders with names starting with "sub" from folder 1, the following line can be used:
/httpdocs/folder1/sub*
Hi, I can not see "Exclude specific files from the backup" option.
What can be the reason?
Hello @Marek,
Please, let me know the Plesk version and OS you use.
Hi. I have Onyx 17.8.11, CentOS 7
@Marek,
Hi! Please go to Tools & Settings > Backup Manager and press the "Back Up" button.
There you may find Backup Settings and Exclude specific files from the backup option will be one of them.
If you cannot see it there, please send me a screenshot of the page that appears after pressing the "Back Up" button.
Hi,
how can I handle to exclude a complete data directory with subfolders and files?
Example:
Data\1\diff. Folders
Data\2\diff. Folders and Files
Data\3\...
So exclude the complete "data" folder with all sub directories and files - that is my question.
Thx
Hi @Michael W!
You should use '*' symbol to do so.
For example, in case Data folder is located in /httpdocs/test/, then use the following example to exclude Date and all its subfolders:
Plesk Onyx Version 17.8.11 Update #32
running on Ubuntu 16.04.5 LTS
Tools & Settings - > Backup Manager -> Back Up -> Exclude specific files from the backup
how to type correct path
what does this "Exclude specific files from the backup" consider as root ???
"/var/www/vhosts/" or something else?
when I add this
/var/www/vhosts/mydomain.com/httpdocs/images/exclude-this-folder/*
still all images in "exclude-this-folder" are INCLUDED in the backup
Hello @Pera Burek,
/var/www/vhosts/mydomain.com/httpdocs/ should be skipped as this option uses relative path inside default document root directory. In your case the path should be set to /images/exclude-this-folder/*
Hello,
can u please tell how to exclude specific database dump files from backup?
Thanks!
@Michael, currently it is not possible, unfortunately.
@Anton Maslov,
Thanks!
Is it in plans?
@Mihael, no such plans at the moment, you may post the suggestion here to consider it in future versions.
is there a way to exclude specific domains from the backup when you use the server wide backup in GUI?
@Wiebe de Wolf,
Such functionality hasn't been implemented yet, but we do have a feature request on it.
Feel free to vote it up if you find it useful.
I also recommend sharing you thoughts in comments of feature request so we can better understand why this one is important.
When excluding a folder, it seems to be still included when Plesk is calculating if there is enough space.
For example, I get this warning:
Hi James001 Please take a look at the following article in order to by pass this issue: https://support.plesk.com/hc/en-us/articles/360005893894
Hi! How should I exclude files according to their extension?
1)
*.tar,*.tar.gz,*.zip,*.gz,*.gzip
2)
*.tar
*.tar.gz
*.zip
*.gz
*.gzip
Thanks!
Hi Santiago Botto!
From what I understand you want to exclude files with specific extensions regardless of where the files are located. For example, .tar files can be located at these paths:
and you would like to exclude all these 3 .tar files.
It can be achieved with help of regular expressions. For the above example, you would need to add the following 2 entries separated by comma to "Exclude specific files from the backup" field:
For each file extension you would need 2 entries. Another example if you want to exclude all .tar and .tar.gz files, these 4 entries separated by comma should be added to the corresponding field:
Hi !
Since excluded files/folders have to be relative paths only, how to exclude a folder from a full server backup if the name of the folder exists for another subscription?
I want to exclude "/var/www/domain-first.tld/data/pictures" but there a "pictures" folder in "/var/www/domain-second.tld/data/pictures".
Will the both folders be excluded from full server backup?
Thanks.
I have the same issue at @Lmt.
We're using a Web Admin license and it seems all backups need to be done from the main account login (as the system/server admin).
We have mydomain1.tld, mydomain2.tld, etc. On some of the domains we have large media files that we don't need backed up.
/httpdoc/media/*
But only on one of the domains. On the other domains we do want to back up the media/ directory.
Seems weird that only relative paths are allowed when backing up from the main server account given that there are likely several domains, some of which might have similar paths that need to be excluded on some domains, but not others.
Suggestion! - If you popped open an interface like in the "file manager" (123.123.123.123:8443/smb/file-manager/list). It would be much easier for us to check files or directories we want to include or exclude in the backup. just a thought.
+1 for the file explorer/picker but anyone has an answer for my question? https://support.plesk.com/hc/en-us/articles/115000773605/comments/360002567539
Please sign in to leave a comment.