• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Exclude a folder from backup?

Hi mr-wolf,

sorry, you are as well wrong.

"/var/www/vhosts/YOUR-DOMAIN.COM" is the document - root for "YOUR-DOMAIN.COM" and therefore all exclusions have to be defined from here.

For the current (MAIN)domain ( which is ALWAYS the documentroot and can't be changed to any other domain configured on your server! ), you would use
Code:
/httpdocs/FOLLOWED-BY-THE-DESIRED-SUBFOLDER/*

;)


List possible folders with the EXAMPLE command:
Code:
ls -lah /var/www/vhosts/YOUR-DOMAIN.COM
 
I was pointing out that YOU confused the other by including /var/www/vhosts

You also wrote that /httpdocs*/ does NOT include /httpdocs/
I doubt that (I didn't test this, though).
Normal usage it should also include that /httpdocs/ folder
His command failed because he included /var/www/vhosts.... (in post #7 you advised him that)

I never wrote anything in this thread that isn't correct.
Starting from #14 you didn't either.
We both agree on how we should use it
 
Last edited:
You also wrote that /httpdocs*/ does NOT include /httpdocs/
I doubt that (I didn't test this, though).
Normal usage it should also include that /httpdocs/ folder

In fact, the asterisk "*" is a placeholder signifying 1 or more of any character... not zero or more.
So /httpdocs*/ does NOT include /httpdocs/
/httpdoc*/ does include /httpdocs/ however
 
In fact, the asterisk "*" is a placeholder signifying 1 or more of any character... not zero or more.
So /httpdocs*/ does NOT include /httpdocs/
/httpdoc*/ does include /httpdocs/ however
In one of the most used commands on a Linux terminal (ls) this is clearly not the case.
Code:
ls /var/www/vhosts/*/httpdocs*/

What Plesk does with it, I don't know. (I made clear each time that I didn't test it in this Plesk exception list)
I think it should follow normal behaviour.

In regular expressions a + sign is used to need at least 1 character.
an asterisk accepts no characters as well.

Code:
# echo 'hello' | egrep 'hello.*'
hello
# echo 'hello' | egrep 'hello.+'
#
 
I have tested the function extensively. For me has worked the following perfect:

Template for Shopware 5:
  • */var/cache/production_*
    • All folders like /var/cache/production_XYZ
  • */web/cache/*.js
    • All files on all customers like /web/cache/XYZ.js
  • */web/cache/*.css
 
I have tested the function extensively. For me has worked the following perfect:

Template for Shopware 5:
  • */var/cache/production_*
    • All folders like /var/cache/production_XYZ
  • */web/cache/*.js
    • All files on all customers like /web/cache/XYZ.js
  • */web/cache/*.css
That's not the issue (if an issue at all)

I think that "/httpdocs*/" should match "/httpdocs/"
@UFHH01 and @G J Piper say that the expression "/httpdocs*/" does NOT match "/httpdocs/"

This may be true (I didn't test it), but I think that would be deviant behaviour.

I disagree with @G J Piper that an asterisk is a wildcard for at least 1 character.
 
That's not the issue (if an issue at all)

I disagree with @G J Piper that an asterisk is a wildcard for at least 1 character.

You know what? I did some Googling of this and see that definitions of the wildcards do in fact say "zero or more characters".
I've been doing this quite a while and never experienced the behavior like that before, however. I've always had to use it as if it represented "one or more" characters. Not sure what to think. Maybe it is in the difference in OSs or in shells? (I use tcsh, many use bash)
 
You know what? I did some Googling of this and see that definitions of the wildcards do in fact say "zero or more characters".
I've been doing this quite a while and never experienced the behavior like that before, however. I've always had to use it as if it represented "one or more" characters. Not sure what to think. Maybe it is in the difference in OSs or in shells? (I use tcsh, many use bash)

I'm doing a lot with regular expressions each day and I always keep in mind that an asterisk may be no characters.
That's why I switch to egrep (as opposed to grep) and use a + instead of an asterisk when I want to extract IPv4 addresses in log files:
Code:
egrep -o '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' /var/log/kern.log | sort | uniq -c | sort -rn

I'm always switching to bash as the shell, but for instance 'ls' has nothing to do with bash.

Still.......
It is still possible that the Plesk exception file is different. I wouldn't know as I didn't test it.

As you are all so sure it doesn't match /httpdocs/, I think you are the ones that should put /httpdocs*/ in the upcoming back-up session.
If you are right it means that it still made a back-up of your /httpdocs/ folders.

Is that a deal?
 
I digress... this does match on my server after all (I was not logged in as root when I tried it before, so it matched nothing)

ls /var/www/vhosts/*/httpdocs*/
 
I digress... this does match on my server after all (I was not logged in as root when I tried it before, so it matched nothing)

ls /var/www/vhosts/*/httpdocs*/
I have an empty Plesk server on which I created a subscription and did a scheduled backup with /httpdocs*/ in the exception list.
Wanted to do this sooner, but it's such a hassle to test.

Although I never said otherwise, @UFHH01 is correct in that it then does NOT exclude the /httpdocs/ folder.
It's not how other (most? all?) Linux commands work.
 
Hi, Running a complete server backup but do not want to include a location within another domain location. So how would you exclude this location?

Thanks
 
How can you complete a server backup but not include a domain?
It's called an "experiment".
There's more to a domain than the /httpdocs folder.
The domains on that server were bogus domains and the backup would have had no other value than to check how Plesk implemented wildcards.

It turned out that Plesk didn't implement wildcards in the same way as linux cli commands.

ls -l httpdocs*/ would include "httpdocs" in the Plesk implementation of these expressions in schedule backup it does not include httpdocs.

Hi, Running a complete server backup but do not want to include a location within another domain location. So how would you exclude this location?

I would think that /*/*/ would do the job.
Do try it first...

It would not give a useful back-up on my systems, but you asked for it.
 
how to exclude folder from backup and all sub-folders below?

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 sub-folders are dynamically created with random names, so it is impossible to think ahead
 
Can't you change it in a way that those random folders are created within some custom folder?

In your case exclude folder1

If not, you could replace the folder in which they are placed now with a symbolic link.
Nothing from that folder will get back-upped.

I can't think of any other workaround.
Only those 2
 
Last edited:
Hi, I want to exclude everything in a domain from a serverwide scheduled backup.
Would be nice if you would provide the same UI you have, to pick parts to restore from backups, to pick parts to exclude.
Or pick what to include in a serverwide backup, either way.

Anyway, I tried (Plesk root is under /mnt/vhosts/ on that server)

/mnt/vhosts/domain.com/*
/mnt/vhosts/domain.com/httpdocs/*
/domain.com/*
*/domain.com/*

But its still backing up everything. The answers given in this thread are rather confusing.
 
Last edited:
Code:
/*/cache/*,/*/*/cache/*,/*/tmp/*,/*/*/tmp/,/*/temp/*,/*/*/temp/*,logs/*.gz,BACKUPS/*
Am I entering this correct for a domain with subdomains and Wordpress websites?

I want to keep the latest log files but not the ones that are Gzipped.

BACKUPS is my folder for manual backups. I wish to exclude manual backups.

Does /* exclude also the files within folders of the actual folder?
example: Would BACKUPS/* also exclude this file BACKUPS/2022/backup.zip?

Thanks!
 
Back
Top