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.
To copy a directory (and all the files it contains), use scp with the -r option. This tells scp to recursively copy the source directory and its contents. You'll be prompted for your password on the source system ( deathstar.com ). The command won't work unless you enter the correct password.
In order to copy a directory on Linux, you have to execute the “cp” command with the “-R” option for recursive and specify the source and destination directories to be copied. As an example, let's say that you want to copy the “/etc” directory into a backup folder named “/etc_backup”.
Copying Directories with cp Command To copy a directory, including all its files and subdirectories, use the -R or -r option.
You can use -r option with scp command to copy directories recursively on any system.
Don't use the -r
flag. It tells scp
to copy recursively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With