yes, I should pay someone for the script. I understand that.
You don't understand though. When you pay someone, for them to do a good job you have to tell them
exactly what the task is.
That means the programs being used, and what the aim of the task is, and the directories being used and the operating system etc.
You let them figure out the best way to solve your task.
Here you want the same task solved, and the people reading can give you the best solution - if you only tell them the same things that you would
have to tell a paid person.
Without all that information you are likely to get a script that doesn't work correctly all the time, or a script that is more complicated than it needs to be.
On top of that, the people who read your posts and help you (for free) get no enjoyment from the task, and will simply not even reply because they have wasted their time in the same situation many times before.
I've tried to explain to you that your description of the task is so limited that it's impossible to even know what you are doing, so your readers can't use their experience to help you.