Disable Filter rules at one shot from Terminal

hi all
i have firewall filter rules from 1 to 100 and i want to disable the rules and enable the rules during testing phase
this method doesn’t works

[admin@MikroTik] ip firewall filter> disable 0-120
invalid item number



[admin@MikroTik] ip firewall filter> disable (0-120)
item number too large

this method works but disables 0 and 120 rules only not from 1 to 120

[admin@MikroTik] ip firewall filter> disable 0,120
[admin@MikroTik] ip firewall filter>

however this works but its tedious you have to specify 0 to 100 using commas

[admin@MikroTik] ip firewall filter> disable 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,
15,16,17,18,19,21,22,23,24,25,26…99,100

so my question here is what’s the syntax to disable rule from 1 to 100 at one shot
Thankyou

:for x from 1 to 100 do={/ip firewall filter set $x disabled=yes}

That should help you :wink:

Thanks..
that really helped me..
but i think that was a programming syantax
not a command
thanks any way

that is a command you can paste directly into a terminal window (tested on 3.14)

How to remove with it?



:for x from 1 to 100 do={/ip firewall filter remove $x}

Hello!
I am having issues with this command:

:for x from 1 to 100 do={/ip firewall filter remove $x}

I sometimes get response:
no such item (4)

And sometimes it just deletes rules as it should. Any ideas why is this happening?

The loop goes from Item 1 to Item 100.

If you deleted some of those items in between or you simply dont have 100, it throws a warning

Hmm, sometimes it worked fine and sometimes not, although I admit it was bit “crude” tool, so I found better:

/ip firewall filter remove [/ip firewall filter find]