Post a reply

Options
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)

Options

Topic review

Nguyen Duc Tien

Copy multi files from a list to Linux Server

In my case, I'd like to copy files in a list to an SSH server. So I guess you want something like that. This is my batch file and it run well.
set WINSCP=D:\Softwares\winscp.com
set REMOTE_STRING=tiennd:password@techlinkvn.com
set REMOTE_FOLDER=/home/tiennd/MycelScrapy/
 
set SRC_LIST=README.md scrapy.cfg
 
@echo off & setlocal
setlocal EnableDelayedExpansion
set winscp_commands=
(for %%f in (%SRC_LIST%) do (
   set winscp_commands=!winscp_commands! "put %%f %REMOTE_FOLDER%"
))
 
%WINSCP%  %REMOTE_STRING%  /command   %WINSCP_COMMANDS%  exit
llong

Posting multiple commands in WinSCP.com

I have to write a script that is for a 32-bit machine to perform SFTP. I need to be able to process multiple commands as different point in the script. In short...
1) Connect to SFTP server
2) Pull a file of available files
3) Parse the list and for each file...
a. Upload the file
b. Perform a process for each file

I am pulling the list using the ls command in strArg..
winscp.StandardInput.WriteLine(strArg);
winscp.StandardInput.Close();

...but when I try to write any subsequent command, I get an error citing "Cannot write to a closed TextWriter". Without the Close() command, the process hangs. How do I invoke the ls without closing the TextWriter?

Thank you