Discussion:
systemd-tmpfiles: file globbing?
(too old to reply)
Frank Van Damme
2024-06-13 10:20:02 UTC
Permalink
systemd-tmpfiles-clean will watch directories and periodically purge old
contents.

eg
d /var/cache/man 0755 man man 1w

will delete files older than a week from /var/cache/man

Is there a way to apply max lifetimes to files matching a pattern? I can't
find any way to tell it to, say, remove *.txt files older than a month from
/tmp/foo.
--
Frank Van Damme
Make everything as simple as possible, but not simpler. - Albert Einstein
Greg Wooledge
2024-06-13 12:10:01 UTC
Permalink
Post by Frank Van Damme
Is there a way to apply max lifetimes to files matching a pattern? I can't
find any way to tell it to, say, remove *.txt files older than a month from
/tmp/foo.
If you're willing to turn away from systemd, find(1) can do this.

find /tmp/foo -type f -iname '*.txt' -mtime +31 -delete

Loading...