|
|
@@ -0,0 +1,233 @@
|
|
|
+using System;
|
|
|
+
|
|
|
+namespace Renci.SshNet.Sftp
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// Represents SFTP file information
|
|
|
+ /// </summary>
|
|
|
+ public interface ISftpFile
|
|
|
+ {
|
|
|
+ /// <summary>
|
|
|
+ /// Gets the file attributes.
|
|
|
+ /// </summary>
|
|
|
+ SftpFileAttributes Attributes { get; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets the full path of the directory or file.
|
|
|
+ /// </summary>
|
|
|
+ string FullName { get; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// For files, gets the name of the file. For directories, gets the name of the last directory in the hierarchy if a hierarchy exists.
|
|
|
+ /// Otherwise, the Name property gets the name of the directory.
|
|
|
+ /// </summary>
|
|
|
+ string Name { get; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets the time the current file or directory was last accessed.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// The time that the current file or directory was last accessed.
|
|
|
+ /// </value>
|
|
|
+ DateTime LastAccessTime { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets the time when the current file or directory was last written to.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// The time the current file was last written.
|
|
|
+ /// </value>
|
|
|
+ DateTime LastWriteTime { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets the time, in coordinated universal time (UTC), the current file or directory was last accessed.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// The time that the current file or directory was last accessed.
|
|
|
+ /// </value>
|
|
|
+ DateTime LastAccessTimeUtc { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// The time the current file was last written.
|
|
|
+ /// </value>
|
|
|
+ DateTime LastWriteTimeUtc { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets the size, in bytes, of the current file.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// The size of the current file in bytes.
|
|
|
+ /// </value>
|
|
|
+ long Length { get; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets file user id.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// File user id.
|
|
|
+ /// </value>
|
|
|
+ int UserId { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets file group id.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// File group id.
|
|
|
+ /// </value>
|
|
|
+ int GroupId { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets a value indicating whether file represents a socket.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if file represents a socket; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool IsSocket { get; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets a value indicating whether file represents a symbolic link.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if file represents a symbolic link; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool IsSymbolicLink { get; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets a value indicating whether file represents a regular file.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if file represents a regular file; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool IsRegularFile { get; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets a value indicating whether file represents a block device.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if file represents a block device; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool IsBlockDevice { get; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets a value indicating whether file represents a directory.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if file represents a directory; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool IsDirectory { get; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets a value indicating whether file represents a character device.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if file represents a character device; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool IsCharacterDevice { get; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets a value indicating whether file represents a named pipe.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if file represents a named pipe; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool IsNamedPipe { get; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets a value indicating whether the owner can read from this file.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if owner can read from this file; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool OwnerCanRead { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets a value indicating whether the owner can write into this file.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if owner can write into this file; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool OwnerCanWrite { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets a value indicating whether the owner can execute this file.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if owner can execute this file; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool OwnerCanExecute { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets a value indicating whether the group members can read from this file.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if group members can read from this file; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool GroupCanRead { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets a value indicating whether the group members can write into this file.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if group members can write into this file; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool GroupCanWrite { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets a value indicating whether the group members can execute this file.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if group members can execute this file; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool GroupCanExecute { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets a value indicating whether the others can read from this file.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if others can read from this file; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool OthersCanRead { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets a value indicating whether the others can write into this file.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if others can write into this file; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool OthersCanWrite { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Gets or sets a value indicating whether the others can execute this file.
|
|
|
+ /// </summary>
|
|
|
+ /// <value>
|
|
|
+ /// <c>true</c> if others can execute this file; otherwise, <c>false</c>.
|
|
|
+ /// </value>
|
|
|
+ bool OthersCanExecute { get; set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Sets file permissions.
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="mode">The mode.</param>
|
|
|
+ void SetPermissions(short mode);
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Permanently deletes a file on remote machine.
|
|
|
+ /// </summary>
|
|
|
+ void Delete();
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Moves a specified file to a new location on remote machine, providing the option to specify a new file name.
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="destFileName">The path to move the file to, which can specify a different file name.</param>
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="destFileName"/> is <c>null</c>.</exception>
|
|
|
+ void MoveTo(string destFileName);
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Updates file status on the server.
|
|
|
+ /// </summary>
|
|
|
+ void UpdateStatus();
|
|
|
+ }
|
|
|
+}
|