Added -p to mkdir so that parent directories are made.