Tar: Exclude folders that have a dynamic name (using wildcard)

I have a backup routine that runs for WordPress sites. There are folders created which are dynamic per installation of WordPress. I cannot, for the life of me, figure out how to exclude the dynamic folder. The convention for the dynamic folders are as follows: /var/www/client1/public_html/wp-content/backupwordpress-aaa1b23456-backups /var/www/client2/public_html/wp-content/backupwordpress-ccc7d89012-backups The dynamic portions are backupwordpress-aaa1b23456-backups and backupwordpress-ccc7d89012-backups. I…

Details

Python – Overriding the initialisation of a class variable

I have a superclass and a subclass that need to handle their initialisation differently, based on a regular expression. See below for a working example. import os import re class Sample: RE = r'(?P<id>\d+)’ STRICT_MATCHING = False def __init__(self, f): self.file = f self.basename = os.path.basename(os.path.splitext(self.file)[0]) re_ = re.compile(self.RE) match = re_.fullmatch if self.STRICT_MATCHING else…

Details