Want to upload multiple files using SFTP to remote server

Advertisement

skumarlingamNC
Guest

Want to upload multiple files using SFTP to remote server

Hello Experts,

I am trying to upload multiple files using below script, somehow batch script picking only first file out of multiple files from local drive and uploads on remote server.

WinScp version 5.9.2

batch command

"C:\Program Files (x86)\WinSCP\WinSCP.exe" /log= V:\BatchScripts\File_Put.log /script=V:\BatchScripts\File_Put.txt

File_Put.txt

# Connect to SFTP server using a password
open sftp://username:password;fingerprint=ssh-**s-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**@sftp.**.com/XYZ/WVW_to_User/
# Upload file
put V:\*.csv /XYZ/WVW_to_User/
exit

Please let me know is there any wrong with script.

Thank you in advance.
[/code]

Reply with quote

Advertisement

Guest

I think you can try doing an LCD to change the directory then try the transfer.

# Connect to SFTP server using a password
open sftp://username:password;fingerprint=ssh-**s-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**@sftp.**.com/XYZ/WVW_to_User/
# Upload file
lcd V:\
put *.csv /XYZ/WVW_to_User/
EXIT

Reply with quote

skumarlingamNC
Guest

Want to upload multiple files using SFTP to remote server

Thank you my friend.

I will try and let you know the progress.

Thank you in advance.


Anonymous wrote:

I think you can try doing an LCD to change the directory then try the transfer.

# Connect to SFTP server using a password
open sftp://username:password;fingerprint=ssh-**s-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**@sftp.**.com/XYZ/WVW_to_User/
# Upload file
lcd V:\
put *.csv /XYZ/WVW_to_User/
EXIT

Reply with quote

skumarlingamNC
Guest

Want to upload multiple files using SFTP to remote server

sorry I changed code as per your suggestion. batch script picking first file and uploading on remote server. not picking other files.

Thank you in advance.

Reply with quote

Guest

Re: Want to upload multiple files using SFTP to remote server

It must be erroring out. I would enable logging to see what exactly is happening. You can also try disabling the permission and timestamp setting to see if that's the problem. https://winscp.net/eng/docs/message_preserve_time_perm


# Connect to SFTP server using a password
open sftp://username:password;fingerprint=ssh-**s-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**@sftp.**.com/XYZ/WVW_to_User/
# Upload file
lcd V:\
put *.csv /XYZ/WVW_to_User/ -nopreservetime -nopermissions
EXIT[/quote][/quote]

Reply with quote

Advertisement

skumarlingamNC
Guest

Want to upload multiple files using SFTP to remote server

You are my hero Thank you. Finally I can upload all my multiple files.

here is the code the one suggested by you.

# Connect to SFTP server using a password 
open sftp://username:password;fingerprint=ssh-**s-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**-**@sftp.**.com/XYZ/WVW_to_User/ 
# Upload file 
lcd V:\ 
put *.csv /XYZ/WVW_to_User/ -nopreservetime -nopermissions 
EXIT

Thank you once again.

Reply with quote

skumarlingamNC
Guest

Want to upload multiple files using SFTP to remote server

sorry for late reply.

Correct. below line is enough to upload multiple files via sftp.

-nopreservetime

thank you though for helping me.

Is that possible after uploading files on remote server can we suffix today's(current) datetime to each file
(example file name: XYZ_10_14_2016.csv)

Please let me know if you want me to open in spread thread.

Thank you in advance.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum