ComponentPro UltimateFtp

      Upload/download files without keeping directory structure - flatten mode

      Language Filter: AllSend comments on this topic to ComponentPro

      The TransferOptions class can even be used to upload (or download) files from multiple directories (or even a whole directory tree) into a single directory - just set the Flatten property to true and call the Upload or Download method. For example, when uploading files "C:\A\a.txt" and "C:\B\b.txt" to "/MyData" directory, both the files end up in the "/MyData" directory (and no "A" or "B" directories are created).

      // All files in "C:\data" will be copied to "/data" without keeping their directory structure.
      TransferOptions opt = new TransferOptions();
      opt.Flatten = true;
      // Upload files.
      client.Upload(@"C:\data", "/data", opt);
      // All files in "C:\A" and "C:\B" will be uploaded to "/mydata" without keeping their directory structure.
      client.Upload(new string[] {@"C:\A", @"C:\B"}, "/mydata", opt);