Skip to main content
All CollectionsBackups
Create pattern based directory paths for file backups
Create pattern based directory paths for file backups

Learn how you can create pattern based directory paths for file backups

Brent Sanders avatar
Written by Brent Sanders
Updated over a week ago

If you have a folder that contains several nested directories of which you'd like to backup certain file paths but not all, you can use pattern matching to achieve this when creating file backups. Take the following example.

A web server with 5 websites using the following directory structure:

/srv/users/foo/
/srv/users/bar/
/srv/users/biz/
/srv/users/bang/
/srv/users/blast/

The various different "users" directories (foo, bar, biz) represent the different websites. Within each of these directories there are additional folders specific to that website. Lets say that these subdirectories follow the following format using "bar" as an example:

/srv/users/foo/apps/
/srv/users/foo/log/
/srv/users/foo/run/
/srv/users/foo/tmp/

If your objective was to backup the "apps" directory of each "users" folder and you didn't want to have to update your backup routine each time a new "users" folder was added you could do this with pattern matching on the path to backup.

When creating your file backup you could simply provide the following path to backup:

/srv/users/**/apps

πŸŽ‰πŸŽ‰πŸŽ‰

We hope you find this helpful! If you need any further assistance, please contact us and we'll be more than glad to help you out.Β 

Did this answer your question?