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.DirectoryInfo for a virtual directory in S3. It exposes properties and methods for enumerating directories and files as well as methods manipulate directories.

Inheritance Hierarchy

System.Object
  Amazon.S3.IO.S3DirectoryInfo

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

Syntax

C#
public sealed class S3DirectoryInfo
         IS3FileSystemInfo

The S3DirectoryInfo type exposes the following members

Constructors

NameDescription
Public Method S3DirectoryInfo(IAmazonS3, string)

Initialize a new instance of the S3DirectoryInfo class for the specified S3 bucket.

Public Method S3DirectoryInfo(IAmazonS3, string, string)

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

Properties

NameTypeDescription
Public Property Bucket Amazon.S3.IO.S3DirectoryInfo

The S3DirectoryInfo for the root of the S3 bucket.

Public Property Exists System.Boolean

Checks with S3 to see if the directory exists and if so returns true. Due to Amazon S3's eventual consistency model this property can return false for newly created buckets.

Public Property FullName System.String

The full path of the directory including bucket name.

Public Property LastWriteTime System.DateTime

Returns the last write time of the the latest file written to the directory.

Public Property LastWriteTimeUtc System.DateTime

UTC converted version of LastWriteTime.

Public Property Name System.String

Returns the name of the folder.

Public Property Parent Amazon.S3.IO.S3DirectoryInfo

Return the S3DirectoryInfo of the parent directory.

Public Property Root Amazon.S3.IO.S3DirectoryInfo

Returns the S3DirectroyInfo for the S3 account.

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 files from the local file system to S3 in this directory. Sub directories are copied as well.

Public Method CopyFromLocal(string, DateTime)

Copies files from the local file system to S3 in this directory. Sub directories are copied as well. Only files that have been modified since the changesSince property will be copied.

Public Method CopyTo(string, string)

Copies the files from this directory to the target directory specified by the bucket and object key.

Public Method CopyTo(string, string, DateTime)

Copies the files from this directory to the target directory specified by the bucket and object key. Only files that have changed since the changeSince date will be copied.

Public Method CopyTo(S3DirectoryInfo)

Copies the files from this directory to the target directory.

Public Method CopyTo(S3DirectoryInfo, DateTime)

Copies the files from this directory to the target directory. Only files that have changed since the changeSince date will be copied.

Public Method CopyToLocal(string)

Copies the files from the S3 directory to the local file system in the location indicated by the path parameter.

Public Method CopyToLocal(string, DateTime)

Copies the files from the S3 directory to the local file system in the location indicated by the path parameter. Only files that have been modified since the changesSince property will be copied.

Public Method Create()

Creates the directory in S3. If no object key was specified when creating the S3DirectoryInfo then the bucket will be created.

Public Method CreateSubdirectory(string)

Creates a sub directory inside the instance of S3DirectoryInfo.

Public Method Delete()

Deletes all the files in this directory as well as this directory.

Public Method Delete(bool)

Deletes all the files in this directory as well as this directory. If recursive is set to true then all sub directories will be deleted as well.

Public Method EnumerateDirectories()

Enumerate the sub directories of this directory.

Public Method EnumerateDirectories(string)

Enumerate the sub directories of this directory.

Public Method EnumerateDirectories(string, SearchOption)

Enumerate the sub directories of this directory.

Public Method EnumerateFiles()

Enumerate the files of this directory.

Public Method EnumerateFiles(string)

Enumerate the sub directories of this directory.

Public Method EnumerateFiles(string, SearchOption)

Enumerate the files of this directory.

Public Method EnumerateFileSystemInfos()

Enumerate the files of this directory.

Public Method EnumerateFileSystemInfos(string)

Enumerate the files of this directory.

Public Method EnumerateFileSystemInfos(string, SearchOption)

Enumerate the files of this directory.

Public Method GetDirectories()

Returns an array of S3DirectoryInfos for the directories in this directory.

Public Method GetDirectories(string)

Returns an array of S3DirectoryInfos for the directories in this directory.

Public Method GetDirectories(string, SearchOption)

Returns an array of S3DirectoryInfos for the directories in this directory.

Public Method GetDirectory(string)

Returns the S3DirectoryInfo for the specified sub directory.

Public Method GetFile(string)

Returns the S3FileInfo for the specified file.

Public Method GetFiles()

Returns an array of S3FileInfos for the files in this directory.

Public Method GetFiles(string)

Returns an array of S3FileInfos for the files in this directory.

Public Method GetFiles(string, SearchOption)

Returns an array of S3FileInfos for the files in this directory.

Public Method GetFileSystemInfos()

Returns an array of IS3FileSystemInfos for the files in this directory.

Public Method GetFileSystemInfos(string)

Returns an array of IS3FileSystemInfos for the files in this directory.

Public Method GetFileSystemInfos(string, SearchOption)

Returns an array of IS3FileSystemInfos for the files in this directory.

Public Method MoveFromLocal(string)

Moves files from the local file system to S3 in this directory. Sub directories are moved as well.

Public Method MoveTo(string, string)

Moves the directory to the target directory specified by the bucket and object key.

Public Method MoveTo(S3DirectoryInfo)

Moves the directory to the target S3 directory.

Public Method MoveToLocal(string)

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

Remarks

It is important to keep in mind that S3 is not a filesystem. It is possible for S3 object keys to contain characters which are not not legal file path characters, and so some pre-existing objects in a bucket that were created with other software may not be compatible with this class.

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5