moved folder creation and permission settings to run query script