Page 1 of 1

Remove older file (only) from NAS

PostPosted: 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., - 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,

Re: Remove older file (only) from NAS

PostPosted: 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.

Re: Remove older file (only) from NAS

PostPosted: 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?

Re: Remove older file (only) from NAS

PostPosted: 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.