attached scripts is working fine functionally. there are some thing to modify only. It is supposed to make two separate files, one for the output mac which are working. and one to update the input file in which it should remove all non working macs. 1. it is creating a separate folder for the input file update. No need of it. Just update the current input file in same folder, means replace it. We already make its backup at start. Name this backup file as (originalfilename)_original.php 2. while updating the input file and removing non working macs from it, it is also removing master mac from it. It should check all macs one by one, regardless of master mac, and remove them after checking. Subsequent master macs should remain in place until they are checked at their sequence. It is necessary, because if the scripts fails in mid-way, we can start again from the same position where it left without changing anything, All already checked macs are removed and remaining are in place along with master mac. All this is already being done in real time and which should remain. 3. if there are duplicated working macs, then only one instance to be recorded in output file Method of input file, processing and all other outputs are perfectly fine. Do not change them, just focus on what I asked.