Download file from sftp site bash script






















Save my name and email in this browser for the next time I comment. Notify me via e-mail if anyone answers my comment. Table of Contents. Related Posts. Didn't find what you were looking for? Perform a quick search across GoLinuxCloud Search for:. Thank You for your support!! Search Blogs. Mark Forums Read. User Name. Remember Me? Linux - Newbie This Linux forum is for members that are new to Linux. Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

SFTP script to download and delete whats been downloaded I need to download files from a sftp site and remove from the site what has been successfully downloaded. View Public Profile. View Review Entries. Find More Posts by netaxiz. Find More Posts by schneidz. There is an ip restriction so first of all i should make a ssh connection.

I wrote a script but it stucks after connecting with ssh. I'm not sure exactly what you're trying to accomplish here. First, I'll address the problems in your expect script. Since your shebang line invokes expect, you don't need to wrap the expect body in a call to expect. That gets rid of all the backslashes. Next, you have 2 spawn calls, which raises questions about you're intent. I'm going to assume that you want to ssh to test1 , then grab the file from test2 so the file exists on test1.

This assumption changes the 2nd spawn to a plain send command. Now, you can scp the file to your local machine. Let's put those 2 steps into one shell script:. Stack Overflow for Teams — Collaborate and share knowledge with a private group. It will create SFTP interaction session. Inside that session we will use sftp mkdir command.

That means we will create a directory structure with same of source location if target location have no such directory structure exists. Then execute:. It will download source file path to the target path. Here in target path we are not providing any file name.



0コメント

  • 1000 / 1000