Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review

To count number of files in SFTP server

Dear Experts,

I am using the below code to download the file present on SFTP server path. I have to add a condition that if only 1 file is present than only it will download & in case more than 1 file is present then it should throw an error message. Any pointer on it?

::1 Download file from SFTP server to Local machine
ECHO Started downloading the files from ERP Cloud SFTP Server %date% %time% >> %logfile%
%WINSCP_EXE_PATH% /command ^
"option batch continue " ^
"option confirm off " ^
"open sftp://%INBOUND_SFTP_CONN%/ "^
"get %INBOUND_SFTP_PATH%*.txt " ^
"close " ^