Ideas to exclude a cache directory structure, but keep one second-level dir


Author
Message
Cy “kkm” K'Nelson
Cy “kkm” K'Nelson
Junior Member
Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)
Group: Forum Members
Posts: 36, Visits: 145
I have large cache directories, which I keep on a separate drive backed up as F&F for this exact reason: I exclude 90% of unimportant files from it.

I keep caches separate under a single \cache root, some by settings, other by soft-linking. Generally, I keep empty top level directories under this common root, but exclude files and directories (some programs get angry red at me if its dedicated directory disappears, other just create, but I keep them all). Generally, it works.

Except one of the programs me fits. As I found, some data, exactly one folder in the cache, is precious (it contains the list of stuff it thinks it has cached, URLs where to get it from etc; without it, it becomes basically useless). The funny thing is the "scratch" directory is selectable via the UI without any tricks at all. But it's not all scratch. Some files must be preserved.

Specifically, my layout is like:

\cache\
+ good1\
| \ (good1's files/folders can be dropped any time)
+ good2\
| \ (good2's files/folders can be dropped any time)
+ \angry
| + \_metadata <= THIS! The rest of stuffNNNN is unimportant.
| + \stuff00001
. . .
| + \stuff99999
. . .


So, when I exclude a folder \cache\*\*, I get nearly what I want. Except I need to keep this sore nail \cache\angry\_metadata\ directory and files in it.

One distinction that I found particularly unhelpful but may be important is that this is the only directory under angry\ starting with the underscore _. If Reflect had a kind of “negating” wildcards, describing stuff except what the expression says, (like bash, only not as ugly, please), or “set” wildcard like [0-9A-Za-z], like even the POSIX sh(1) has, IIRC, it would be... possibly helpful, but I still don't grok how. But I understand Reflect's expressions are simple splats * which match whole path fragments up to a path separator, and question marks ? for a single character. Am I missing a feature here? Also, all other cache directories start with an alphanumeric. I'm cant see how it would help my case, but rather just wondering whether the complete definitive documentation on the wildcards could be found.

Ideally, I'd Exclude(cache\*\*) then Include(\cache\angry\_metadata\*), But, as I understand it, the order of inclusions/exclusions is fixed, and exclusions always trump inclusions.

So I'm kinda lost how to achieve that. Currently, I placed this _metadata/ directory outside the cache/ subtree, so that it is is backed up, and symlinked in into the cache\angry\ directory. The downside is that the softlink must be re-created after restore, but it's a small matter compared with the not forgetting of doing that, especially under stress of disaster recovery, when long-term recall is often inhibited. I put a README_AFTER_RESTORE.txt into the directory that I have no reason to even look into after restore, just in case, but this is obviously not the best solution, if a solution at all.

When I run out of better ideas, I'll script a desired-state restoration script and schedule it.

Any better ideas are appreciated!

Cy “kkm” K'Nelson
Cy “kkm” K'Nelson
Junior Member
Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)Junior Member (58 reputation)
Group: Forum Members
Posts: 36, Visits: 145
I found this lab notebook: https://forum.macrium.com/post/49255

Looks like the answer is, unfortunately, “better don't even think of that.” Reflect's wildcarding is anything than simple and consistent.

I wrote a page-long post-restore PowerShell script to create directories and a softlink to a separate directory not in the cache/ subtree, which is backed up. A script is still necessary, because the cache directory is not saved at all in the backup, but it should have a more permissive ACL that it would inherit from the volume if it were simply created.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Login

Explore
Messages
Mentions
Search