02-09-2010
1) take the size of the files in local host
2) take the size of file after sftp from remote host
ssh -n remote_host ls -ltr file | awk '{print$5}'
##This will give you the size of sftped file from remote host
3) compare the size of the file to make sure it transfered successfully ..
10 More Discussions You Might Find Interesting
1. Cybersecurity
Hi,
I'm in the process of writting some scripts using sftp2 on a HP UX 11.11 machine.
I've found that when I do an 'ls' command , even when in batch mode, it asks for me to 'press any key to continue or q to quit' after a screenful of data. Of course in batch mode this cause the script to hang.... (0 Replies)
Discussion started by: sudojo
0 Replies
2. Shell Programming and Scripting
Hi,
I have a folder ABC.
I have sftp executing from this folder successfully to other servers using keys which avoids passowrd prompt.
The permissions for the folder are only for user.ie drwx------
But i need another id to access my folder and execute the scripts.
So i changed the access... (2 Replies)
Discussion started by: borncrazy
2 Replies
3. Shell Programming and Scripting
Hi I need to perform the following task using shell script.
establishing a sftp connection to a server.
then get the latest file from there to our own server.
But i am not finding ny suitable command in sftp console to get the latest file.
can anyone help me in this reagrd.
if ny other... (1 Reply)
Discussion started by: UBD
1 Replies
4. Shell Programming and Scripting
Hi,
I am doing a FTP from a Unix host to a windows host. I have generated the key in my unix server and added them in the destination host. In the Destination they changed the ip address now i am not able to connect. I can see it is reaching till that server but i am not receiving that server... (2 Replies)
Discussion started by: Krrishv
2 Replies
5. UNIX for Advanced & Expert Users
Hi
my sftp batch run connect to the server and transfer the txt file to target server. but when I run again same batch with same file it give error.
Any idea about this error.....
regards
Jamil
edit by bakunin: please do not "hijack" threads. That is: if you have a genuine... (1 Reply)
Discussion started by: Jamil Qadir
1 Replies
6. Shell Programming and Scripting
I have written a samll sftp script abc.sh as below
sftp user@remote-server <<EOF
lcd /home/gopi
cd /home/raju
get COA
exit
EOF
Its working. But when i rin the script, it gives the acknowledgement like ,
sftp> lcd /home/gopi
sftp> cd /home/raju
sftp> get COA
Fetching... (3 Replies)
Discussion started by: Gopal_Engg
3 Replies
7. Shell Programming and Scripting
I want to execute shell script with in sftp session for remote server.
like i have a shell script test.sh that is on local server.i want to execute like
sftp user@192.168.56.10
sftp> test.sh ---execute for remote server not for local server.
Please help me for this issue (2 Replies)
Discussion started by: SAUD PASHA
2 Replies
8. Shell Programming and Scripting
I have an sftp script which is uploading file into a directory which is not specified wth the cd command . For example:
sftp sftpserver
>>lcd /abc
>>cd /tmp/bef
>> put /abc/abc.txt /tmp/bef/abc.txt
Uploading file from /abc/abc.txt to /xyz/wxy/tmp/bef/abc.txt
>>quit
The file is getting... (2 Replies)
Discussion started by: NP1
2 Replies
9. HP-UX
Dear All,
Previously we push file using ftp in outside node. Now we try sftp, but connection is not established. I am provide you the debug log. Any idea to solve the issue?
tabs@tabsdb02:/ccbs/users/tabs$ sftp -vvv e132079@205.140.6.188
OpenSSH_5.8p1+sftpfilecontrol-v1.3-hpn13v7,... (0 Replies)
Discussion started by: makauser
0 Replies
10. UNIX for Beginners Questions & Answers
i have a problem no a dream :)
i have a list and i want to do :
cat lista_olo
for file in `cat list`
do
sftp myuser@myip << EOF
ls -l mydir/$file/
EOF
but there is an error . Syntax error at line 11 : `<' is not matched
How can i do ?
Regards. (1 Reply)
Discussion started by: Francesco_IT
1 Replies
LEARN ABOUT CENTOS
libssh2_sftp_read
libssh2_sftp_read(3) libssh2 manual libssh2_sftp_read(3)
NAME
libssh2_sftp_read - read data from an SFTP handle
SYNOPSIS
#include <libssh2.h> #include <libssh2_sftp.h>
ssize_t libssh2_sftp_read(LIBSSH2_SFTP_HANDLE *handle, char *buffer, size_t buffer_maxlen);
DESCRIPTION
handle is the SFTP File Handle as returned by libssh2_sftp_open_ex(3)
buffer is a pointer to a pre-allocated buffer of at least
buffer_maxlen bytes to read data into.
Reads a block of data from an LIBSSH2_SFTP_HANDLE. This method is modelled after the POSIX read(2) function and uses the same calling
semantics. libssh2_sftp_read(3) will attempt to read as much as possible however it may not fill all of buffer if the file pointer reaches
the end or if further reads would cause the socket to block.
RETURN VALUE
Number of bytes actually populated into buffer, or negative on failure. It returns LIBSSH2_ERROR_EAGAIN when it would otherwise block.
While LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
ERRORS
LIBSSH2_ERROR_ALLOC - An internal memory allocation call failed.
LIBSSH2_ERROR_SOCKET_SEND - Unable to send data on socket.
LIBSSH2_ERROR_SOCKET_TIMEOUT -
LIBSSH2_ERROR_SFTP_PROTOCOL - An invalid SFTP protocol response was received on the socket, or an SFTP operation caused an errorcode to be
returned by the server.
SEE ALSO
libssh2_sftp_open_ex(3) libssh2_sftp_read(3)
libssh2 0.15 1 Jun 2007 libssh2_sftp_read(3)