#!/bin/bash # #Author: IRFAN NASEEF # # if [ $# -lt 1 ] then echo "Error:Specify atleast a file" exit 1 ; fi echo "Specify Destination folder" read dest; for file in $@ do if [ -f $file ] then echo "Copying file $file to $dest" scp $file b070147cs@192.168.40.99:$dest if [ $? -eq 0 ] then echo "Successfull" else echo "Error :copying" fi else echo "Error: $file doesnot exist" exit 2 ; fi done exit 0; #############################################And if you have done as per this post(see here) , you can save typing passwords too .
Saturday, April 24, 2010
script to copy file to remote server (Using scp)
I always want to copy files to my athena account, which is the server in our lab where i have an account.So i wrote this script , which helps me not to write a long line command always.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment