961 folder creation

fixes #961
Style/GuardClause: Use a guard clause instead of wrapping the code inside a conditional expression.