I think you have made a logical mistake here, which happens to be solved by a syntactical mistake.
You should add a ! before targetDir - you want to create the folder if it doesn't exist, not if it already exists.
Now your code still works because of the ; right after the if. Right now, your code is equal to this:
So if you add the ! and remove the ; you should be fine: