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
- Running SCP in quiet mode
- How to transfer files recursively using SCP?
- How to show progress when using SCP?
- How to overwrite files using SCP?
- Is it possible to SCP files in parallel?
- How to use an SSH key when using SCP?
- How to use a different port when using SCP?
- How to transfer files using wildcards with SCP?
- How to run SCP in verbose mode?
See more codes...