Collect list of filenames from remote directory in local text file using command line

Advertisement

nishit.2571988@gmail.com
Joined:
Posts:
6
Location:
Ahmedabad

Collect list of filenames from remote directory in local text file using command line

winscp> call ls \fileList.txt
This is not work

Not work directory listing in separate text file

expected output
filelist.txt
file1
file2
file3

Reply with quote

Advertisement

nishit.2571988@gmail.com
Joined:
Posts:
6
Location:
Ahmedabad

Log or xml log is not work

My code is like below log or xml log is not created. Once xml log is work then I retrieve file listing from xml log.
Process winscp=null;
ProcessStartInfo startInfo=new ProcessStartInfo
{
  FileName="C:\\Program Files (x86)\\WinSCP\winscp.com",
  RedirectStandardInput=true,
  RedirectStandardOutput=true,
  RedirectStandardError=true,
  UseShellExecute=false,
  CreateNoWindow=true,
}
winscp.StartInfo=startInfo;
winscp.Start();
winscp.BeginOutputReadLine();
winscp.BeginErrorReadLine();
 
try
{
  winscp.StandardInput.WriteLine("winscp.com /log=\"c:\\Users\Test\Desktop\\log.txt\" /xmllog=\"c:\\Users\Test\Desktop\\xmllog.xml\"");
  winscp.StandardInput.WriteLine("open ftp://XXXX:XXXX@XXXX.com");
  winscp.StandardInput.WriteLine("lcd c:\\Users\Test\Documents");
  winscp.StandardInput.WriteLine("cd /'XXX.' ");
  winscp.StandardInput.WriteLine("ls");
 
}
catch(Exception ex)
{
}

Reply with quote

Advertisement

You can post new topics in this forum