Remove older file (only) from NAS

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Remove older file (only) from NAS Wed Sep 01, 2021 8:54 pm • by jhkoning
hi there,

so here's what i've got so far. i'm a wordpress dev, i have backup's automatically sent to folders in my dropbox (db, plugin's & theme backup's). db is a scheduled backup & remains in dropbox.
plugin's & themes are on demand.
as soon as a file plugins-*.zip appears in a dropbox folder, it's moved to the corresponding folder on my nas.
this is basically to keep my dropbox storage under control & to allow me to run archive backup's on the nas.
this is running spot on.

the zip files that are created contain a random hash in the file name, so they are going to be different every time they are created & subsequently moved to my nas.
plugins-12345.zip, plugins-6789.zip - you get the idea.
what i'd like is a rule that will run on that nas folder, say weekly, monthly (or on demand), that will trash the older zip file (only).
is this even possible given the file names won't be the same?

also, (newbie question here) want happens if the dropbox - nas rule runs if I'm not on my local network, will it automatically re-run when it's next attached to the nas?

thanks for reading, any pointers very much appreciated,
Jason
jhkoning
 
Posts: 3
Joined: Wed Sep 01, 2021 8:35 pm

Re: Remove older file (only) from NAS Fri Sep 03, 2021 4:43 pm • by Mr_Noodle
How about doing "Date added is not among the 1 most recent". That will match anything except the most recent file. You can also add conditions to pattern match on the name and the zip extension.
Mr_Noodle
Site Admin
 
Posts: 9781
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Remove older file (only) from NAS Sun Sep 05, 2021 7:10 pm • by jhkoning
spot on! thanks very much - works perfectly.

just one more thing, if the rule runs when i'm not attached to my nas (like when i'm not in the office) what happens?
will it re-run when it is re-attached to my nas?
will it error out?
just wondering if i should set the rules to run at a certain time, when i'm more likely to be in the office & attached to the nas?
jhkoning
 
Posts: 3
Joined: Wed Sep 01, 2021 8:35 pm

Re: Remove older file (only) from NAS Tue Sep 07, 2021 10:37 am • by Mr_Noodle
It would error out but should run when it's reattached. If you see otherwise, let me know.
Mr_Noodle
Site Admin
 
Posts: 9781
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support