Rules for keeping specific files in cleanup policy.

Hello,

So I have a raw hosted repo in my Nexus setup and I need to do some cleanup with specific rules. I need to keep regardless of age every folder and its contents that is under a “master” folder and also some variations of “mc” ,and “standalone_” I have achieved that via a regex for the cleanup policy, however I want to also keep all the contents of folders that contain a file called recepients.txt. My regex is able to do all except the last part , it basically keeps only the recepients.txt file, but all other files in the folder are deleted. Does anyone have experience with such a use case for cleanup policies in Nexus? My regex for the policy is:

^(?!.*(?:/|^)(master|(?i).*?[-_]?mc[-_]?.*?|Standalone_)(?:/|$))(?!.*recepients\.txt).*

If I cant achieve keeping files based on the existance of one file, does Nexus support redirects? For example if an upload to the repo is incomming and it contains a keyword then the content will be redirected to repo2 other wise it continues to repo1.

I’m not seeing an obvious way to do what you’re asking for. We have looked at using the Pro tagging feature as a way to control cleanup policies.

What is recipients.txt, is this you keeping track of whether a package has been distributed to downstream stakeholders?

The normal way to implement this kind of this is with the Pro staging feature. There are REST endpoints that can pick up components and move them between repositories. This is commonly used to have aggressive cleanup for freshly made builds (e.g. keep them 48 hours), then keep any builds that were staged for 30 days from last use, and then anything shipped to production or downstream customers is kept for a year since last use or indefinitely.

Who is updating recipients.txt? Is this something you’ve got some automation updating when people download something, or is this just an internal note that you maintain when you make a file available to a downstream consumer?