This is an old revision of the document!
RemoteFileInfo Class
Represents data about remote file.
Advertisement
Syntax
Namespace: WinSCP
C#
public sealed class RemoteFileInfo
VB.NET
Public NotInheritable Class RemoteFileInfo
Properties
Name | Description |
---|---|
FilePermissions FilePermissions | File permissions. Read-only. |
char FileType | File type. - for regular file, D for directory, L for symbolic link, etc. Read-only. See also IsDirectory . |
string FullName | File path. Read-only. This feature is available only in the latest beta release. |
string Group | File group. |
bool IsDirectory | Is file a directory? (i.e. FileType is D ). Read-only. |
bool IsParentDirectory | Is it a reference to a parent directory (.. )? Read-only. This feature is available only in the latest beta release. |
bool IsThisDirectory | Is it a reference to this directory (. )? Read-only. This feature is available only in the latest beta release. |
DateTime LastWriteTime | Timestamp of the last file modification. Read-only. |
long Length | Size of the file in bytes. Read-only. |
int Length32 | An alternative to Length . Particularly useful for COM hosts, that do not support 64-bit integers, such as Visual Basic. Throws OverflowException , when the file size cannot be expressed using 32-bit integer. |
string Name | File name (with Session.ListDirectory ) or file path (with Session.GetFileInfo ). Read-only. In the beta version, it returns a file name only in both cases. For the file path, use the FullName . |
string Owner | File owner. |
Advertisement
Methods
Name | Description |
---|---|
string ToString() | Returns Name . (Overrides Object.ToString() .) |
Remarks
Instance of the class can be created by the WinSCP assembly only. You can only get an instance of the class by calling Session.ListDirectory
or Session.GetFileInfo
.
Examples
See example for Session.ListDirectory
.
Real-Life Examples
- Checking file existence and timestamp;
- Listing files matching wildcard;
- Search recursively for text in remote directory / Grep files over SFTP/FTP protocol;
- Recursively download directory tree with custom error handling;
- Find duplicate files in SFTP/FTP server;
- Custom directory listing format (CSV).