How to resume failed/interrupted downloads with SFTP? - shell

I am using GitBash and I am downloading a file greater than 10GB and it stopped halfway. I don't want to download the whole file again from start. How can I start the download from where it was stopped with SFTP?
I have tried reget command it showed cannot download non-regular file.

(Assuming, you are using OpenSSH sftp), use its reget command. It has the same syntax as the get, except that it starts a transfer from the end of an existing local file.
The same effect has -a switch to the get command or global command-line -a switch of sftp.
You need OpenSSH 6.3 and later for these features

Related

GCP SDK gsutil rsynch not returning progress

When I run gsutil rsynch from the GCP Console, or a .bat file, the full progress data does not display (it used to I'm pretty sure.) I'm on vers 403.0.0
Here is the command:
>gsutil rsync -r -n \\xxxx\WEBSITE\xxx\pages gs://xxx/pages
Building synchronization state...
Starting synchronization...
>
If I run the same command, followed by a pause in a .bat file, the pause is not hit - the batch file terminates. glist (maybe others) do output their data to the console and continue on to the balance of the batch commands.
c:
cd "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\"
gsutil rsync -r -d \\xxx\pages gs://xxx/pages
pause <<<<< never get here
If I use .Net Process I can capture the Standard Out which does contained the progress data. However StdOut seems to close well after rsynch has finished.
Is this a bug? Or am I missing something?
I recommend that you update to the latest gsutil release.
I tested on my machine and also on the Cloud Shell, both with the rsync version 4.31 and they display the progress of the command, listing the files being copied.
I reproduced the script on different environments and observed that the script skips the commands after the rsync complete only on Windows machines. I tested on Google Cloud SDK Shell and also on Cygwin for Windows.
However, on a Linux machine and also on Cloud Shell, the same script works as expected and it executes the subsequent commands after the rsync completes.
This behavior depends on the implementation of individual shells. You will need to catch the unexpected behavior and handle the situation in the desired way, as the solution differs depending on the environment.

Transfer file in Secure Shell

I use Secure Shell as a Chrome extension (https://chrome.google.com/webstore/detail/secure-shell/pnhechapfaindjhompbnflcldabbghjo?hl=da)
Now I have finished some programming and I need the file on my computer.
How can I transfer the file to my computer? Can I send it by email or something?
I have tried yanking all the lines in vim, but I still don't get it copied to my windows clipboard.
One entertaining (and moderately ridiculous) approach would be sprunge.
Run this on the remote machine:
cat myFile | curl -F 'sprunge=<-' http://sprunge.us
And then visit the URL it prints on your local machine. :D
I presume that you are using Windows OS and trying to download your file from a Linux like OS.
You use MobaXterm and it comes with a file transfer features.
http://mobaxterm.mobatek.net
On a CLI you can use "scp" to download and upload.
Another one is you can also use FileZilla using SFTP protocol

Winzip command line error and message handling

I'm trying to automatically zip a group of files and move them to a different location.
This is the command i'm using for the script:
<WinzipPath> -a -r -en <Dest&Name>.zip <source>
Problem is that at any given moment one of the files is still being written, and when i try to zip it i get the following message which interrupts my automation:
Any idea on how do I ignore\skip the message via CMD? tried looking in the Winzip's Doc for more flags but couldn't find anything helpful
Another (smaller) issue is that when zipping for the first time after installing I get this message:
Can I skip that as well?
Are you using WinZip or WinZip Command-line Add-on?
You will do much better when scripting to use WZZIP which is installed after installing the command-line Add-on in the WinZip folder. NOTE: You must have WinZip Professional installed first.
http://winzip.com/downcl.html
Better yet, if you have the option to use 7-zip.. Understand if you have to use WinZip, but 7-zip handles large archives and more files within an archive better (IMHO). Also, I have previously asked about 7-zip having the ability to move a file to file and the Developer of 7-zip did respond: https://stackoverflow.com/a/21209385/175063
Try adding -min
<WinzipPath> -min -a -r -en <Dest&Name>.zip <source>
So you minimise the user interface, and it should not show message windows

Windows batch command ftp

is there anyone who can tell me how to make a batch which connects to at ftp server and downloads the latest file from the server.
I only need the newest file, not the old ones.
You could use something like wget for Windows, which can be configured to download only newer files than those you currently have, like this:
wget -N ftp://username%3Apassword#FTPServerAddress/dir/*
check this.It requires powershell (all windows 7 machines have it by default).It's juest easier to compare dates with it.

What does "download or create" mean in a tofrodos context?

I keep seeing this phrase "download or create" in tutorials right after tofrodos. What would be an example of how to download or create? I just get stuck in
^
^
^
mode.
apt-get -y install tofrodos
Download or create ZPX_ubuntu_12-04_auto_installer.sh
The author means you need to transfer the "ZPX_ubuntu_12-04_auto_installer.sh" shell script to the server, and if necessary, change to the directory you saved the script in using the cd command, before entering the commands below:
fromdos ZPX_ubuntu_12-04_auto_installer.sh
chmod +x ZPX_ubuntu_12-04_auto_installer.sh
./ZPX_ubuntu_12-04_auto_installer.sh
He seems to be referring to a particular script included in a .zip file posted on a web forum.
You may be able to download the .zip file to your computer, extract it, and then use the sftp or scp program to transfer just the shell script to the server. Alternatively, you could use wget or curl to download the .zip file to the server and then the unzip command to unzip it.
A graphical SFTP client like FileZilla may help for the former approach. The Firefox add-on cliget may help for the latter, especially because the file is hosted on a password-protected web forum.
fromdos is just a utility program to convert a text file from DOS/Windows format to Unix format by stripping out all the carriage return characters. Perhaps using this command is necessary because the author of the script used a Windows text editor or an ASCII-mode FTP transfer before zipping up the file. Of course, you need the file on the server if you are trying to run the command on the server.

Resources