uuu777
uuu777

Reputation: 901

sftp uploading to non-existing directory

Say I have to upload file dir-a/dir-b/dir-c/xxx.txt using sftp

  1. Should I create the target directory first?
  2. Should I open target directory before copying the file?
  3. If have to create this path dir-a/dir-b/dir-c - is it one command or three?

Upvotes: 0

Views: 1270

Answers (1)

Jakuje
Jakuje

Reputation: 25946

Should I create the target directory first?

Usually yes. SFTP servers usually do not create parent directory. But how hard is it to try first?

Should I open target directory before copying the file?

You do not have to. put command does accept a remote-path, which can be either absolute or relative to remote working directory.

If have to create this path dir-a/dir-b/dir-c - is it one command or three?

These are three commands:

mkdir dir-a/
mkdir dir-a/dir-b/
mkdir dir-a/dir-b/dir-c

Upvotes: 1

Related Questions