sftp -b doesn't read the batchfile


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sftp -b doesn't read the batchfile
# 1  
Old 08-04-2008
sftp -b doesn't read the batchfile

Several of our end-users need to send a file to our insurance carrier using ssh and sftp. We've put together a Windows VBS script that opens the ssh tunnel and calls sftp with the -b option pointing to a batch script in the same directory, however sftp doesn't seems to be reading from the batchfile. There are no error messages, and once we have the sftp prompt we can manually run the lcd, cd and put commands to transfer the file. Is there another option that needs to be added to the sftp command in addition to the -b option to get it to read from the batch script? The full sftp command is:

sftp -oIdentityFile=c:\openssh\userkeys\SSHkey -oPort=999 sshuser@localhost -bsend_files.srp"

send_files.srp is something like this:

lcd J:\path\to\outgoing
cd /path/to/incoming
put file.dat
quit

We're using OpenSSH do do the transfer.

kmw
# 2  
Old 08-04-2008
fixed it

easy...put the -b option at the *beginning* of the sftp command line:

sftp -bsend_files.srp -oIdentityFile=c:\openssh\userkeys\SSHkey -oPort=999 sshuser@localhost -bsend_files.srp"
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SSh works but sftp doesn't for all users except root

I am sorry if i post in wrong Form. i have AIX server in which ssh works for all users but sftp only works for root user . it is too much important for me to solve this . Your help will be greatly appreciated. (1 Reply)
Discussion started by: khalid khanAIB
1 Replies

2. Shell Programming and Scripting

Read in script doesn't work

I am trying to run a script to make a simple modification to a number of similar files. The sed works, but after it runs and the differences are displayed, the script does not read ans to start a renaming script if the user answered Y or y.for i in "$@" do sed -f myfile.sed $i >$i.new diff... (2 Replies)
Discussion started by: wbport
2 Replies

3. UNIX for Dummies Questions & Answers

Sftp using batchfile - storing result local

I'm making an sftp-connection to a remote server. I want the result of an ls-command in a local file and the result of ls on another folder in another local file. Because everything has to go as fast a possible I wan't to do everyting in one connection. The command I use is : psftp -v -batch -b... (4 Replies)
Discussion started by: pistach
4 Replies

4. UNIX for Dummies Questions & Answers

Help on commands in sftp using BatchFile

Hi, The script didn't continue as "20130109" folder is already created on the destination server. Please help. Entry in script: cat > $filebatch << __EOF__ mkdir $current_date mkdir $current_date/$fpdomain cd $current_date/$fpdomain ls -l __EOF__ Error: sftp -b... (12 Replies)
Discussion started by: chococrunch6
12 Replies

5. Shell Programming and Scripting

URGENT : vi doesn't read my .exrc

I have created some custom commands (using the map macro feature) and have those map commands in my $HOME/.exrc file (I am using bash) Here are the commands, which I have in my $HOME/.exrc map! F /user\.base\.scope^V^Mk4ddF map! L /user\.base\.search^V^Mk4ddL map! V... (1 Reply)
Discussion started by: inditopgun
1 Replies

6. Shell Programming and Scripting

sftp can't fine batchfile "No such file or directory"

Hi, I've got a C program that is using execlp to run a non-interactive sftp (using a batchfile) session to send some files to another system. Just before doing that, I create the batchfile called sftp_batch on the fly: V8_26_1:sun-->cat /workspace/sftp_batch cd /tmp/newsftp put test.file... (2 Replies)
Discussion started by: Fiaran
2 Replies

7. Shell Programming and Scripting

sftp mget where file doesn't exist BASH

I have a script that is working: #!/bin/bash sftp user@domain.com <<EOF cd somedir mget *.csv quit EOF but on a crontab I want to only pull newer files, so I want to do something like: while read ls current dir local file != true do mget that new file but I'm not sure the syntax... (2 Replies)
Discussion started by: unclecameron
2 Replies

8. Shell Programming and Scripting

Passing variables: sftp using -b batchfile

Hi All, I have created a script for an sftp transfer that works without a date variable being passed, I want it to work with a date variable being passed. So, my initial script, mainsftp.sh, looks like this: ----------------------------------------------------------------------- #... (1 Reply)
Discussion started by: j_miller
1 Replies

9. Shell Programming and Scripting

script doesn´t read last line

hi, i have a file with 5 lines, like this: 068|3|20080331|P|21090|5|0|0|0|0|0|0|0 068|3|20080331|P| |6|0|0|0|0|0|0|0 068|3|20080331|P|21040|7|0|233|105|161|6157|6656|101 068|3|20080331|P| |T|188842|33996|14543|3226|7193|247800|298 068|3|20080331|T|... (2 Replies)
Discussion started by: DebianJ
2 Replies

10. Shell Programming and Scripting

Automate batchfile generation for sFTP

Hey all, I am writing a script for sFTP using batchfile option (-B). My script is supposed to monitor a certain directory for several files and when they are found I will send them to a testing server. So using a static batchfile wouldn't be feasible, I am just wondering if anyone can show... (0 Replies)
Discussion started by: mpang_
0 Replies
Login or Register to Ask a Question