Can we create an "expiry date" for files / folders?

Hey all,

Can I create an expiry date on files and folders to keep my drives clean? I have screengrabs that I need to make, and need to use, but I don't need to keep them forever. If I could give them a lifespan of six months, say, and have them auto-destruct, that would be great. I'm sure the mighty Opus would make that possible, anyone? (Leo, obviously :slight_smile: )

All the best,

B

You could set up a filter which finds files to delete based on some criteria (age, filename, location), and then periodically click a button or hotkey which runs the delete command with that filter.

Script events could make it run automatically, although if you want something fully automated and in the background then I would probably use Task Scheduler or something, and not use Opus at all.

I think it's also possible to hook extra rules into the Windows disk clean-up tool, which could be a good fit for this, but I'm not sure how much work that involves.

Thanks, Leo,
I knew you'd get back to me :slight_smile: Task Scheduler seems to be a good route, but my choices are start a program or script. Could I use Start a program to call DOpus to delete files older than yay, in a specific directory and sub-directories?

Thanks,

B

You could use dopusrt.exe to run an Opus command from outside of Opus. https://www.gpsoft.com.au/help/opus12/index.html#!Documents/DOpusRT_Reference.htm

But if you're going the Task Scheduler route then it might be cleaner to just have it run a generic script which does everything without interacting with Opus.

just a batch file then? Thanks for your support Leo.

B

It might be possible with a batch file but I'm not sure. I'd probably use JScript to do it, since that has objects to let you search in/below a folder, checking names against regular expression and dates against your criteria.

Depends how comfortable you are with that though. What I'd do might not be best for you, of course!

Windows 10 has the ForFiles command, which seems like it ought to do the trick :slight_smile:

All the best,

B

That looks perfect. I didn't know that was there. :smiley:

Another option would be a stored query, if you could work out the AQS syntax :slight_smile: