It actually came out of the fact that someone else(my team lead) mistakenly put a space in a path that didn't contain that space, crashing the script. When I told my team lead he instructed me to create a check for spaces in the variable string path. Thanks for the help.