This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request. Did you try to search for it? I’m sure there are enough examples out there you could adapt to your needs.
And BTW: When you post code or error messages or sample data or console output format it as code using the code tags “PRE“, please. Thanks in advance.