Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 789953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:36:28+00:00 2026-05-14T21:36:28+00:00

This script is to connect to different servers and copy a file from a

  • 0

This script is to connect to different servers and copy a file from a loaction defined.
It is mandatory to use sftp and not ftp.

#!/usr/bin/ksh -xvf

Detail="jyotibo|snv4915|/tlmusr1/tlm/rt/jyotibo/JyotiBo/        jyotibo|snv4915|/tlmusr1/tlm/rt/jyotibo/JyotiBo/"

password=Unix11!
c_filename=import.log
localpath1=`pwd`
for i in $Detail
        do

                echo $i
                UserName=`echo $i | cut -d'|' -f1`
                echo $UserName
                remotehost=`echo $i | cut -d'|' -f2`
                echo $remotehost
                remote_path=`echo $i | cut -d'|' -f3`
                echo $remote_path
                {
                echo "open $remotehost
                user $UserName $password
                lcd $localpath1
                cd $remote_path
                bi
                prompt
                mget $c_filename
                prompt
                "
                } |ftp -i -n -v 2>&1


        done

I want to do the similar thing using sftp instead of ftp.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:36:28+00:00Added an answer on May 14, 2026 at 9:36 pm

    The solution i got is below:

    #!/usr/bin/ksh -xvf
    
    Detail="jyotibo|snv4915|/tlmusr1/tlm/rt/jyotibo/JyotiBo/|import.log     jyotibo|snv4915|/tlmusr1/tlm/rt/jyotibo/JyotiBo/|impor
    t_1.log"
    
    
    for i in $Detail
            do
                    echo $i
                    remote_path=`echo $i | cut -d'|' -f3`
                    file_Name=`echo $i | cut -d'|' -f4`
                    echo "cd $remote_path" > .jyoti.batch.dat
                    echo "get $file_Name" >> .jyoti.batch.dat
                    echo "bye" >> .jyoti.batch.dat
                    UserName=`echo $i | cut -d'|' -f1`
                    echo $UserName
                    remotehost=`echo $i | cut -d'|' -f2`
                    echo $remotehost
                    sftp -b .jyoti.batch.dat $UserName@$remotehost       
             done
    rm -f  .jyoti.batch.dat
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to use this snippet from the Soundcloud API: <script src=http://connect.soundcloud.com/sdk.js> <script> SC.initialize({
I have this code in a .html.erb file: <script src=http://connect.facebook.net/en_US/all.js#xfbml=1></script> <script> FB.Event.subscribe('edge.create', function(response) {
Alright well, I connect to 3 different ip's when I run this script. It
I am looking forward to connect two different database from different servers. Also, i
This is my php script for fetching data from a db. <?php mysql_connect(host,user,pass); mysql_select_db(db);
For this script, it checks to see if the file is a microsoft words
I have a lot of different servers that I connect to. Each time I
I'm trying to create an FTP script that will copy a local folder structure
I wrote a bash script to connect to an ftp server and download files
This script saves the files as /home/name/main/all my files and stuff . I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.