Bash: scp all files in a directory, but not the subdirectory

Cokes picture Cokes · Jul 11, 2013 · Viewed 21.4k times · Source

I would like to copy all files from a remote destination in a particular directory writegrid, but not the subdirectories, e.g. the files in writegrid/output_files.

This

scp -r [email protected]:~/writegrid/* ./

will copy the files in the writegrid/output_files over as well.

Thank you.

Answer

cabad picture cabad · Jul 11, 2013

Don't use the -r flag. It tells scp to copy recursively.