AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Mimics the System.IO.FileInfo for a file in S3. It exposes properties and methods manipulating files in S3.

Inheritance Hierarchy

System.Object
  Amazon.S3.IO.S3FileInfo

Namespace: Amazon.S3.IO
Assembly: AWSSDK.S3.dll
Version: 3.x.y.z

Syntax

C#
public sealed class S3FileInfo
         IS3FileSystemInfo

The S3FileInfo type exposes the following members

Constructors

NameDescription
Public Method S3FileInfo(IAmazonS3, string, string)

Initialize a new instance of the S3FileInfo class for the specified S3 bucket and S3 object key.

Properties

NameTypeDescription
Public Property Directory Amazon.S3.IO.S3DirectoryInfo

Returns the parent S3DirectoryInfo.

Public Property DirectoryName System.String

The full name of parent directory.

Public Property Exists System.Boolean

Checks S3 if the file exists in S3 and return true if it does.

Public Property Extension System.String

Gets the file's extension.

Public Property FullName System.String

Returns the full path including the bucket.

Public Property LastWriteTime System.DateTime

Returns the last time the file was modified.

Public Property LastWriteTimeUtc System.DateTime

Returns the last time the file was modified in UTC.

Public Property Length System.Int64

Returns the content length of the file.

Public Property Name System.String

Returns the file name without its directory name.

Public Property Type Amazon.S3.IO.FileSystemType

Returns the type of file system element.

Methods

Note:

Asynchronous operations (methods ending with Async) in the table below are for .NET 4.5 or higher. For .NET 3.5 the SDK follows the standard naming convention of BeginMethodName and EndMethodName to indicate asynchronous operations - these method pairs are not shown in the table below.

NameDescription
Public Method CopyFromLocal(string)

Copies the file from the local file system to S3. If the file already exists in S3 than an ArgumentException is thrown.

Public Method CopyFromLocal(string, bool)

Copies the file from the local file system to S3. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.

Public Method CopyTo(string, string)

Copies this file's content to the file indicated by the S3 bucket and object key. If the file already exists in S3 than an ArgumentException is thrown.

Public Method CopyTo(string, string, bool)

Copies this file's content to the file indicated by the S3 bucket and object key. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.

Public Method CopyTo(S3DirectoryInfo)

Copies this file to the target directory. If the file already exists in S3 than an ArgumentException is thrown.

Public Method CopyTo(S3DirectoryInfo, bool)

Copies this file to the target directory. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.

Public Method CopyTo(S3FileInfo)

Copies this file to the location indicated by the passed in S3FileInfo. If the file already exists in S3 than an ArgumentException is thrown.

Public Method CopyTo(S3FileInfo, bool)

Copies this file to the location indicated by the passed in S3FileInfo. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.

Public Method CopyToLocal(string)

Copies from S3 to the local file system. If the file already exists on the local file system than an ArgumentException is thrown.

Public Method CopyToLocal(string, bool)

Copies from S3 to the local file system. If the file already exists on the local file system and overwrite is set to false than an ArgumentException is thrown.

Public Method Create()

Returns a Stream that can be used to write data to S3.

Public Method CreateText()

Returns a StreamWriter that can be used to write data to S3.

Public Method Delete()

Deletes the from S3.

Public Method MoveFromLocal(string)

Moves the file from the local file system to S3 in this directory. If the file already exists in S3 than an ArgumentException is thrown.

Public Method MoveFromLocal(string, bool)

Moves the file from the local file system to S3 in this directory. If the file already exists in S3 and overwrite is set to false than an ArgumentException is thrown.

Public Method MoveTo(string, string)

Moves the file to a a new location in S3.

Public Method MoveTo(S3DirectoryInfo)

Moves the file to a a new location in S3.

Public Method MoveTo(S3FileInfo)

Moves the file to a a new location in S3.

Public Method MoveToLocal(string)

Moves the file from S3 to the local file system in the location indicated by the path parameter.

Public Method OpenRead()

Returns a Stream for reading the contents of the file.

Public Method OpenText()

Returns a StreamReader for reading the contents of the file.

Public Method OpenWrite()

Returns a Stream for writing to S3. If the file already exists it will be overwritten.

Public Method Replace(string, string, string, string)

Replaces the destination file with the content of this file and then deletes the orignial file. If a backup location is specifed then the content of destination file is backup to it.

Public Method Replace(S3DirectoryInfo, S3DirectoryInfo)

Replaces the destination file with the content of this file and then deletes the orignial file. If a backupDir is specifed then the content of destination file is backup to it.

Public Method Replace(S3FileInfo, S3FileInfo)

Replaces the destination file with the content of this file and then deletes the orignial file. If a backupFile is specifed then the content of destination file is backup to it.

Public Method ReplaceLocal(string, string)

Replaces the content of the destination file on the local file system with the content from this file from S3. If a backup file is specified then the content of the destination file is backup to it.

Version Information

.NET Framework:
Supported in: 4.5 and newer, 3.5