Overwrite file with new sniffed packets

I am using sniffer to sniff packets for a short duration say 20sec . I want to overwrite the file with new sniffed packets . Right now while saving packets both old and new packets are written into the file. After 20 sec the sniffer restarts sniffing so I want to write only packets sniffed in that duration into the file. How can I do that?
Thanks in advance.

I’ve never seen the behavior you describe. For me, it’s always overwritten the file with each new capture.

Sir, I have written script as /interface wireless sniffer sniff wlan1 and put this into scheduler which runs for 1 min after that the next scheduler runs script to save file. Is the problem coming because we need to stop the sniffer then save file and then start sniffer again ? This way the data will be recollected. How can I stop the sniffer? I didn’t find any option to stop it from script.

Hi, I have the same problem to do periodic wireless sniffs with scripts. How can we stop wireless sniffer?
START => /interface wireless sniffer sniff interface=wlan1
STOP => ??