ComponentPro UltimateFtp

      Set permissions of multiple files and directories

      Language Filter: AllSend comments on this topic to ComponentPro

      Ultimate FTP provides both methods for setting permissions of a single file or multiple files. To set permissions of multiple files, use the SetMultipleFilesPermissions method of the Ftp class. The following example shows you how easy it is to set permissions of multiple files.

      To understand more about wildcard masks and search criterion, see this topic.
      using System;
      using ComponentPro.Net;
      using ComponentPro.IO;
      // Create a new class instance.
      Ftp client = new Ftp();
      // Connect to the FTP server.
      // Authenticate.
      client.Authenticate("userName", "password");
      // ... 
      // Set files' permissions to OwnerRead + OwnerWrite recursively.
      client.SetMultipleFilesPermissions("/", FtpFilePermissions.OwnerRead | FtpFilePermissions.OwnerWrite, true, new NameSearchCondition("*.dat"));
      // ... 
      // Disconnect.