Don't copy the folder, only copy the contents: <!-- language: bash --> ## Create the target directory. The -p suppresses error messages ## if the directory already exists mkdir -p outputFolder ## Copy the contents recursively, this will not recreate the parent cp -R inputfolder/* outputfolder/ This way you both ensure that the target dir is created the first time the script runs and avoid the issue when running it a second time. Both [`-p` for `mkdir`](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/mkdir.html) and [`-R` for `cp`](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html) are defined by POSIX so this should be perfectly portable.