Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Sftp using batchfile - storing result local Post 302854735 by pistach on Wednesday 18th of September 2013 07:58:54 AM
Old 09-18-2013
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 batchfile.ftp @ACCOUNT@remoteserver

The batchfile.ftp contains the following :

Code:
lcd *local directory*
cd folder1
ls *.txt filename1.lst
cd ../folder2
ls *.txt filename2.lst
bye

running the command doesn't give any errors. The results are displayed in the terminalwindow. But the local files aren't build. I want to use these commands in a script and need the 2 files. Can anybody help? How can I create these files using 1 connection. (redirecting the output of the psft-command isn't a solution because I need 2 seperate files.)

Last edited by radoulov; 09-18-2013 at 09:06 AM..
 

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

sFTP result

Hi all, batchfile ====== lcd /home/data/ cd /tmp/source/ get "*.temp.ack" quit Result from sftp ============ 1111.temp.ack| 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M2222.temp.ack | 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M3333.temp.ack | 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M As I don't know... (4 Replies)
Discussion started by: mpang_
4 Replies

3. Shell Programming and Scripting

Problem storing SSH result in a variable

i have this SSH command which runs perfectly on command prompt in sunOS ssh -o Port=${portno} ${uname}@${server} find ${dir_path} -name '***' output : /usr/local/home/*** My problem is when i run same command in my script #!/usr/bin/ksh res=`ssh -o Port=${portno} ${uname}@${server}... (1 Reply)
Discussion started by: prash184u
1 Replies

4. Shell Programming and Scripting

storing result of a command in variable

For whatever reason I cant seem to fix my syntax to do the following. I want to run a grep and count how many instances come up and store that number in a variable but I keep erroring out. Here's my code in bash: number=grep blah file.txt | wc -l (1 Reply)
Discussion started by: eltinator
1 Replies

5. Shell Programming and Scripting

Issue while storing grep result

Hi All, Command: grep -i -n "rule" *.err *.log | grep -v "SP_RULE" The above command when run gives me two -three lines of output. Now I am storing the result of the grep command ie, ruleerrors=`grep -i -n "rule" *.err *.log | grep -v "SP_RULE"` Now when I echo the value of ruleerrors, I... (6 Replies)
Discussion started by: Sreejith_VK
6 Replies

6. Shell Programming and Scripting

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... (1 Reply)
Discussion started by: kmw
1 Replies

7. 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

8. 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

9. Shell Programming and Scripting

Pattern matching & storing result in variable

Hi! i'm trying to parse textfiles against a pattern and storing the result in a variable. The strings i want to get are embraced by and can occur several times in one line, so e.g. some text anything else endwhat i have so far: #!/bin/bash for f in $* do exec 3<&0 exec 0<$f ... (2 Replies)
Discussion started by: thoni
2 Replies

10. 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
rpdump(1)						      General Commands Manual							 rpdump(1)

NAME
rpdump - pine remote data utility SYNTAX
rpdump [ -f ] -l Local_file -r Remote_folder DESCRIPTION
Rpdump may be used to copy the actual data from remote Pine configuration files or address books into a local file. It is intended to be used by system administrators. Regular users should normally use the facilities provided within Pine. Local_file will normally be a local temporary file. Remote_folder is the IMAP folder being used as a remote Pine configuration (with the help of Pine's -P, -p, and -x commands or PINECONF, PINERC, and PINERCEX environment variables) or remote Pine address book folder. A copy of the data from Remote_folder will be copied to Local_file. -f Force the dump even if the remote folder is in an unrecognized format. -l Local_file The file on this system that is to be copied to. -r Remote_folder A remote folder name to be copied from. See the Pine documentation for the syntax of a remote folder name. One exam- ple is {my.imap.server}remote_pinerc. DIAGNOSTICS
Exit status is zero if all goes well, -1 otherwise. SEE ALSO
Rpload(1). Copyright 1989-2001 by the University of Washington. Pine and Pico are trademarks of the University of Washington. $Date: 2001/10/01 19:24:03 $ rpdump(1)
All times are GMT -4. The time now is 01:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy