0

I would like to use the command put to recover an ongoing file transfer via sftp after a broken pipe.

Files should be uploaded only if the destination size is smaller than the one of the source file.

I don't have ssh access so rsync is not an option.

From the sftp manual, I tried specifying the flags put -a -r source_dir/. However, I got error messages in the transfer.

  • Error: Couldn't stat remote file: No such file or directory for files not on server
  • Error: Destination file bigger or same size as source file for files that are already on server, and correctly shouldn't be transferred

Real example for the 1st error:

Uploading of file /Volumes/Seagate/amphioxus/raw_h5/9N0Bp0b0_m150427_041848_42182_c100810932550000001823181110291543_s1_p0.2.bax.h5.gz to /deposits/Pacbio_amphioxus/raw_h5/9N0Bp0b0_m150427_041848_42182_c100810932550000001823181110291543_s1_p0.2.bax.h5.gz failed!
Couldn't stat remote file: No such file or directory

Of course, the file exists in the source directory.

Any solutions for this?

3 Answers 3

0

Not a solution to this, but a workaround is to mount the server locally and then simply copy the data.

sshfs can be used to mount the remote directory:

sudo sshfs -o allow_other,default_permissions user@xxx.xxx.xxx.xxx:/ /mnt/local_directory

Then use

cp -ru

where u updates the files that are in the mounted remote directory with the missing ones.

1
  • sshfs needs an ssh access, which @aechchiki does not have. Mar 21, 2021 at 13:32
0

The best solution would be to ask an administrator of the remote system to give you ssh access and use rsync, or maybe only rsync access if that is possible.

sftp can put (and get) files, but not directories (directory trees with their content).

A workaround is to create a tarball [compressed] tarfile and put it with sftp.


tar -cvzf filename.tar.gz source_dir/

If you need to restore from it, get it with sftp check the content

tar -tvf filename.tar.gz

make sure you are in the correct directory, and extract from the tarball,

tar -xvf filename.tar.gz
0

Use option -a of sftp. man sftp states that this instruct sftp to "Attempt to continue interrupted transfers rather than overwriting existing partial or complete copies of files. If the partial contents differ from those being transferred, then the resultant file is likely to be corrupt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.