Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 21293

Scripting • Re: How to delete backup and RSC files that have been stored for more than 1 month

$
0
0
Hi !

Please, how could a counter be added to know the number of files that the cycle is going to delete?
Code:
{:global datetime2epoch/system clock:local now   [$datetime2epoch ("$[get date] $[get time]")]:local wait  2592000 ; # seconds, 1 month:local fdate 0:local countFiles /file:foreach file in=[find where type~"backup|script" && name~"usb1"] do={    :set fdate [$datetime2epoch [get $file creation-time]]    :if ($sdate) do={        :set countFiles [print count-only where .id=$file]        # remove $file    }}:put $countFiles:log info "[ $countFiles ] backup files have been deleted"}
Thanks.

Statistics: Posted by diamuxin — Sat Mar 16, 2024 9:13 pm



Viewing all articles
Browse latest Browse all 21293

Trending Articles