in reply to help with unlink cont.
I can't believe i was so stupid. looking over what i did in the script, directly after deleting the file i have it open it for writing thus creating a new one. So foolish of me. I swapped those two snippets and now it should work
Thanks for everything