scpHow to automatically create destination directory when using SCP?
SCP (Secure Copy Protocol) is a secure file transfer protocol used to copy files between two remote hosts. It is possible to automatically create a destination directory when using SCP by using the -T
flag.
Example code
scp -T /path/to/source/file user@host:/path/to/destination/
Output example
/path/to/destination/ created
Code explanation
scp
: the command to initiate the SCP protocol-T
: the flag to create the destination directory if it does not exist/path/to/source/file
: the path to the source fileuser@host
: the user and host of the destination/path/to/destination/
: the path to the destination directory
Helpful links
More of Scp
- How to run SCP in verbose mode?
- Running SCP in quiet mode
- How to show progress when using SCP?
- How to overwrite files using SCP?
- How to transfer files recursively using SCP?
- Is it possible to SCP files in parallel?
- How to use SCP with a password?
- How to list files using SCP?
- How to enable logging when using SCP?
- How to SCP from a remote to a local machine?
See more codes...