so I got this python script that removes duplicated files and sort them into folders corresponding to their extension .
what I want to do is when someone uploads a folder to the website than clicks a button the python script is called and starts , it creates a folder to store the sorted files for users to later download those files.
Since javascript is client side, you'd need to set up some sort of backend that can handle the data sent by the user and then sorts it. moustafa linked a very good explanation, I reccomend reading that and you should be sorted.
Using a python script by calling it through javascript