linux - Run SFTP commands in a bash script -
hi community dwellers,
i have requirement -
- need place csv files local linux server remote linux/windows box.
actions -
- we have passwordless connectivity establish between local , remote boxes.
able sftp remote server below command -
sftp -o port=11001 user@xx.xx.xx.xx
able copy using put command -
put /dir/local/*.csv user@remote:/usr/dir/
tried execute above commands in bash script , can reach till sftp login.
- tried running batchfile (in try 1) in statement in step 1, can see uploading data, when pwd, folder empty, no idea files getting written, same try 2 statement -
try 1 - sftp -b test.sh -o port=11001 user@xxx.xx.xx.xx
or
try 2 - sftp -o port=11001 {user}@{host}:{remote_dir} <<< $'put {local_file_path}'
Comments
Post a Comment