# Smartrule for deleting oldest 5 files in a group before moving over a file?

**URL:** <https://discourse.devontechnologies.com/t/smartrule-for-deleting-oldest-5-files-in-a-group-before-moving-over-a-file/70619>\
**Category:** DEVONthink\
**Created:** [April 20, 2022, 11:49am UTC](https://discourse.devontechnologies.com/t/smartrule-for-deleting-oldest-5-files-in-a-group-before-moving-over-a-file/70619 "2022-04-20T11:49:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeltak](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/z/a88e4f/32.png) [@zeltak](https://discourse.devontechnologies.com/u/zeltak)\
**Post date:** [April 20, 2022, 11:49am UTC](https://discourse.devontechnologies.com/t/smartrule-for-deleting-oldest-5-files-in-a-group-before-moving-over-a-file/70619/1 "2022-04-20T11:49:08Z")

</div>

Hi all, I have this simple Devonthink smartrule

 ![CleanShot 2022-04-20 at 14.43.13@2x](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/f/3/f348530ab91961941a4be02e63c57058d3ec1e33.png)

which looks for my daily music content backups (just a list) and moves it to a Devonthink group:

 ![CleanShot 2022-04-20 at 14.47.58@2x](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/3X/7/2/723b1c0ac97edb51f894124cbac8ed00345acc3f.jpeg)

I wonder if there is a way to only keep the 5 most recent files in that group so when I move the new daily file it auto deletes old ones and keeps the latest 5?

thx a lot!

Z

---

<div class="post-metadata">

**Author:** ![cgrunenberg](https://discourse.devontechnologies.com/user_avatar/discourse.devontechnologies.com/cgrunenberg/32/7172_2.png) [@cgrunenberg](https://discourse.devontechnologies.com/u/cgrunenberg)\
**Post date:** [April 20, 2022, 12:02pm UTC](https://discourse.devontechnologies.com/t/smartrule-for-deleting-oldest-5-files-in-a-group-before-moving-over-a-file/70619/2 "2022-04-20T12:02:19Z")

</div>

> [@zeltak](#):
>
> I wonder if there is a way to only keep the 5 most recent files in that group so when I move the new daily file it auto deletes old ones and keeps the latest 5?

One possibility might be to use a daily smart rule which deletes files older than 5 days.

---

<div class="post-metadata">

**Author:** ![zeltak](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/z/a88e4f/32.png) [@zeltak](https://discourse.devontechnologies.com/u/zeltak)\
**Post date:** [April 20, 2022, 12:20pm UTC](https://discourse.devontechnologies.com/t/smartrule-for-deleting-oldest-5-files-in-a-group-before-moving-over-a-file/70619/3 "2022-04-20T12:20:28Z")

</div>

perfect!

thx so much @cgrunenberg!

best

Z

---

<div class="post-metadata">

**Author:** ![system](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/2X/4/4e6ff70c96be2eb307a274d890bba8d71ba671b3.png) [@system](https://discourse.devontechnologies.com/u/system)\
**Post date:** [April 19, 2025, 12:20pm UTC](https://discourse.devontechnologies.com/t/smartrule-for-deleting-oldest-5-files-in-a-group-before-moving-over-a-file/70619/4 "2025-04-19T12:20:29Z")

</div>

Closed on April 19, 2025, 12:20pm UTC

This topic was automatically closed 1095 days after the last reply. New replies are no longer allowed.
