Refactor directories import function in rake sync task