Cokes
Cokes

Reputation: 4083

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

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.

Upvotes: 16

Views: 28936

Answers (2)

band
band

Reputation: 149

use '' in your path as below

scp [email protected]:'~/writegrid/*' .

Upvotes: 3

cabad
cabad

Reputation: 4575

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

Upvotes: 23

Related Questions