Set a file to automatically delete after x days?

I have a folder full of random files from things I download or export when working on projects. I often only need to use them for 1-2 days but then I forget about the files. To help me better house clean these folders is there a way to set the file to auto-delete?

I would love to assign a hotkey that would set that file to automatically delete after x amount of days?

You could send these files to a dated collection and set up a command that runs when Opus starts, deleting this collection when it's old enough.

I'd prefer it to remain in that folder because sometimes the files are linked to programs for editing etc

Yes. That's how collections work :slight_smile:

1 Like

oh really, I never knew about collections, i will have to read up on this

1 Like

Interesting. Need to check. Thanks

@lxp thanks for the help so far you have been a great help!
So this is getting close to what I need. I have setup a collection named Temp. Assigned a hotkey so I can quickly copy file to Temp collection.
Few extra things i'd like:

  1. Add some sort of icon/colour/highlight to files that are in Temp collection

  2. Automatically schedule the temp folder to self empty every week

:one: Set up a Filter Label (Preferences / Labels / Label Assignments), e.g.

=Exists("coll://temp\" + name)

:two: Run a User Command like this on start-up or via task scheduler:

=return DatePart(Now(), "D") == "1" ? "Delete FILE=" + "" + "coll://temp\*" + "" : "@output:Not a Sunday!"
XML
<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
	<label>Delete Temp on Sunday</label>
	<icon1>#newcommand</icon1>
	<function type="normal">
		<instruction>=return DatePart(Now(), &quot;D&quot;) == &quot;1&quot; ? &quot;Delete FILE=&quot; + &quot;&quot; + &quot;coll://temp\*&quot; + &quot;&quot; : &quot;@output:Not a Sunday!&quot;</instruction>
		<instruction />
		<instruction />
		<instruction>// https://docs.dopus.com/doku.php?id=reference:evaluator:datepart</instruction>
	</function>
</button>

This deletes the files in the collection every Sunday, no matter how long they have been in there.

(Try with a button first, I am a bit weary when it comes to auto-deleting things)

2 Likes