Suppose there is dir variable selected by user. (as shown here)
For MAC OS
For WINDOWS OS
For different operating system in full path above is the code to create folder correctly. see the difference of slash and back slash.
FOR ANY EXTENSION / SCRIPT / PLUGIN WORK DON’T HESITATE TO LEAVE ME A MESSAGE OR CONTACT ME at firstname.lastname@example.org