this post was submitted on 19 Jul 2024
175 points (98.3% liked)

Asklemmy

43343 readers
1200 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy πŸ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~

founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Blizzard@lemmy.zip 128 points 1 month ago (13 children)

My current company has a script that runs and deletes files that haven't been modified for two years. It doesn't take into account any other factors, just modification date. It doesn't aks for confirmation and doesn't even inform the end user about.

[–] Kimjongtooill@sh.itjust.works 85 points 1 month ago (1 children)

You should write a script to touch all the files before their script runs.

[–] Blizzard@lemmy.zip 23 points 1 month ago (4 children)

Thought about it but I use modification date for sorting to have the stuff I've recently worked on on top. I instead keep the files where the script isn't looking. The downside is they are not backed up so I might potentially lose them but if I don't do that, then I'll lose them for sure...

[–] Perhyte@lemmy.world 28 points 1 month ago (1 children)

You don't actually have to set all the modification dates to now, you can pick any other timestamp you want. So to preserve the order of the files, you could just have the script sort the list of files by date, then update the modification date of the oldest file to some fixed time ago, the second-oldest to a bit later, and so on.

You could even exclude recently-edited files because the real modification dates are probably more relevant for those. For example, if you only process files older than 3 months, and update those starting from "6 months old"^1^, that just leaves remembering to run that script at least once a year or so. Just pick a date and put a recurring reminder in your calendar.

^1^: I picked 6 months there to leave some slack, in case you procrastinate your next run or it's otherwise delayed because you're out sick or on vacation or something.

[–] barsquid@lemmy.world 4 points 1 month ago

Change the date on all the files by scaling to fit the oldest file. Scale to 1 year as a safe maximum age. So if the oldest file is 1.5 years old, scale all files to be t/1.5 duration prior to now.

[–] Reverendender@sh.itjust.works 16 points 1 month ago

Have you…called attention to this at all?

[–] LazaroFilm@lemmy.world 3 points 1 month ago

Have a script that makes a copy of all files that are 1.9 years old into a separate folder.

[–] MNByChoice@midwest.social 2 points 1 month ago* (last edited 1 month ago)

Create a series of folders labeled with dates. Every day copy the useful stuff to the new folder. Every night change modified dates on all files to current date.

load more comments (11 replies)