Set up regular task to clear ~/Downloads of older files

main
Bo Jeanes 2024-08-11 19:18:33 +10:00
parent 5f38f29d38
commit f366cf3e49
No known key found for this signature in database
1 changed files with 19 additions and 0 deletions

View File

@ -170,6 +170,25 @@
'';
};
launchd.user.agents.gc-downloads =
let
# shell = "${pkgs.bash}/bin/bash";
find = "${pkgs.findutils}/bin/find";
downloads = "/Users/${myUsername}/Downloads";
in
{
serviceConfig = {
ProcessType = "Background";
RunAtLoad = true;
StartInterval = 6 * 60 * 60; # every 6 hours
};
script = ''
${find} ${downloads} -type f -mtime +30 -print -delete
${find} ${downloads} -type d -not -wholename "${downloads}" -empty -print -delete
'';
};
homebrew.enable = true;
homebrew.taps = [
"exoscale/tap"