I'd like to configure the Android 6 Auto Backup feature to exclude all files in entire directories (both in "files" and "external"), also some specific extensions should be excluded. Will wildcards like . and *.tn-png work for the path value? I cannot explicitly define all files since these are created at run-time.
android:fullBackupContent="@xml/mybackupscheme"
where mybackupscheme would for example be this:
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<exclude domain="file" path="device-links.xml"/>
<exclude domain="file" path="*.tn-png"/>
<exclude domain="file" path="links/*.*"/>
<exclude domain="external" path="external-links/*.*" />
</full-backup-content>
Thanks in advance,
The official documentation says:
path: Specifies a file or folder to include in or exclude from backup. Note that: This attribute does not support wildcard or regex syntax.
So you can't use wildcards.
But you can use exclude to exclude entire directories
<exclude>- Specifies a file or folder to exclude during backup.
If you have really complex file structure, you can implement own BackupAgent and overide onFullBackup method.
You can't easily express the set of files you want to backup with XML rules. In these rare cases, you can implement a BackupAgent that overrides onFullBackup(FullBackupDataOutput) to store what you want. To retain the system's default implementation, call the corresponding method on the superclass with super.onFullBackup().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With