How to get list of folders when using batch

Advertisement

Julia
Joined:
Posts:
1

How to get list of folders when using batch

Hi,
I am using "batch" and I can't get my head around how can I pull list of subfolders from parent folder on FTP site. Here is the script I use. Thanks a lot =)
string ftpDetails = "ftp://xxx@xxx.org.uk:xxxxxx@ftp.xxxxxx.co.uk:990 -implicit";
 
string batchFileName = @"\\xxx\xxx\xxx\Julia\TEST_Images\Transfer\batch.txt";
string logFileName = @"\\xxx\xxx\xxx\Julia\TEST_Images\Transfer\ftp.log";
 
string sourceFolder = "/xxx/xxx/Export/Images"; //this is parent FTP folder   
string destinationFolder = @"\\xxx\xxx\xxx\Julia\TEST_Images\Transfer\Live\"; //this is On-Premise folder
 
string batch =
    "option batch on" + Environment.NewLine +
    "option confirm off" + Environment.NewLine +
    "open " + ftpDetails + Environment.NewLine +
    "cd " + sourceFolder + Environment.NewLine +
    "option transfer binary" + Environment.NewLine +
 
    //"get " + sourceFolder + Environment.NewLine + //no luck
    //"get " + sourceFolder + "/" + Environment.NewLine + //no luck
    //"get " + sourceFolder + "/*" + Environment.NewLine + //no luck
    //"get " + sourceFolder + "//*" + Environment.NewLine + //no luck
 
    "close" + Environment.NewLine +
    "close" + Environment.NewLine +
    "exit" + Environment.NewLine
    ;
File.WriteAllText(batchFileName, batch);
 
string arg = "\"/script=" + batchFileName + "\" /log=\"" + logFileName + "\"";
 
ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(@"\\care-sql-prd01\winscp$\WinSCP.com", arg);
Process p = new System.Diagnostics.Process();
p.StartInfo = info;
p.Start();
p.WaitForExit();

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum