Hi,
I have situation where i need to automate transferring 10000+ files using sftp.

while read line
do
if [ -d "$line" ]; then
echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt
fi
done< files.txt
sftp -b sftpCommand.txt stu@192.168.2.1

The above code executes each sftp command written to sftpCommand.txt.
If some error occurs while executing any sftp command,how do i log which individual sftp command(inside sftpCommand.txt) generated the error.
Please advice

sftp can pass flags directly to ssh so you may want to investigate that. Also there is a -v flag you can use which increasing logging (also passed directly to ssh ).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.