JS - Remove unnecessary directories