move the code to another function

because I want to do more folder in one time