Don't copy the folder, only copy the contents:
## 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 directory is created the first time the script runs and avoid the issue when running it a second time.
Chris Down very correctly points out that in bash, this will skip files whose name starts with a .. To avoid this, you can run shopt -s dotglob before running the command above. Alternatively, and for other shells, you can include them explicitly:
cp -R inputfolder/* inputfolder/.* outputfolder/ Both -p for mkdir and -R for cp are defined by POSIX so this should be perfectly portable.