Sponsored Content
Top Forums Shell Programming and Scripting Scripting multiple file "puts" in sFTP... Post 101898 by thestevew on Tuesday 14th of March 2006 06:03:10 AM
Old 03-14-2006
Looks like a job for a here-document. I don't use sFTP but in old fashioned unsecure ftp you would do something like:

Code:
for file in *.txt
do
ftp -n <destinationserver><<EOF
user <userid password>
cd <destinationdirectory>
put ${file}
bye
EOF
sleep 600
done

The commands between <<EOF and EOF (you can use any character string but the start and end strings must be identical with no leading/trailing spaces) are executed as if you typed them in at the keyboard

hope this helps

cheers
 

8 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

3. Shell Programming and Scripting

How to Write sftp through "expect" for file upload ?

Hi Experts , I am new to unix programming please tell me how to write expect and hoe to call it for automated file upload process. help me really ! (0 Replies)
Discussion started by: kulbhushan
0 Replies

4. Shell Programming and Scripting

AWK for multiple line records RS="^" FS="#"

I have to pull multiple line records with ^ as the record separator(RS)... # should be my field separator (FS)... Sample record is: ^-60#ORA-00060: deadlock detected while waiting for resource ORA-00001: unique constraint (SARADM.TCKNUM_PK) violated#PROC:AVAILABLE_FOR_GETNXTTIC#02/27/2012... (7 Replies)
Discussion started by: Vidhyaprakash
7 Replies

5. Shell Programming and Scripting

Scripting to fix the issue in UNIX file having delimiter "|"

hello All, I am new user to shell scripting, kindly advise on the below? I have a file where i have gaps & the delimiter falls in next line and new line is also created , plz see the example :employee.txt Now the issue here is , i wan to write a script , where i can use "|" to get the... (6 Replies)
Discussion started by: sunnyd1
6 Replies

6. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

7. Shell Programming and Scripting

SFTP batch not renaming file with "put"

I have a .ksh script that creates an sftp batch file and runs it through sftp. It works except for one thing. If I try to "put" to a different name, it doesn't use the specified remote name...it still "puts" the original local name. I've tried both of these, and neither work...it will always... (4 Replies)
Discussion started by: dbiggied
4 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
FTP_SSL_CONNECT(3)							 1							FTP_SSL_CONNECT(3)

ftp_ssl_connect - Opens an Secure SSL-FTP connection

SYNOPSIS
resource ftp_ssl_connect (string $host, [int $port = 21], [int $timeout = 90]) DESCRIPTION
ftp_ssl_connect(3) opens an explicit SSL-FTP connection to the specified $host. Note Why this function may not exist ftp_ssl_connect(3) is only available if both the ftp module and the OpenSSL support is built statically into php, this means that on Windows this function will be undefined in the official PHP builds. To make this function available on Windows you must compile your own PHP binaries. Note ftp_ssl_connect(3) is not intended for use with sFTP. To use sFTP with PHP, please see ssh2_sftp(3). PARAMETERS
o $host - The FTP server address. This parameter shouldn't have any trailing slashes and shouldn't be prefixed with ftp://. o $port - This parameter specifies an alternate port to connect to. If it is omitted or set to zero, then the default FTP port, 21, will be used. o $timeout - This parameter specifies the timeout for all subsequent network operations. If omitted, the default value is 90 seconds. The timeout can be changed and queried at any time with ftp_set_option(3) and ftp_get_option(3). RETURN VALUES
Returns a SSL-FTP stream on success or FALSE on error. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.2.2 | | | | | | | The function was changed to return FALSE when it | | | can't use an SSL connection, instead of fallback- | | | ing to a non-SSL one as previously. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 ftp_ssl_connect(3) example <?php // set up basic ssl connection $conn_id = ftp_ssl_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); echo ftp_pwd($conn_id); // / // close the ssl connection ftp_close($conn_id); ?> SEE ALSO
ftp_connect(3). PHP Documentation Group FTP_SSL_CONNECT(3)
All times are GMT -4. The time now is 09:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy