Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IFileSystem

    Provides methods allowing the manipulation of files.

    Namespace: Umbraco.Cms.Core.IO
    Assembly: Umbraco.Core.dll
    Syntax
    public interface IFileSystem

    Properties

    View Source

    CanAddPhysical

    Gets a value indicating whether the filesystem can add/copy a file which is on a physical filesystem.

    Declaration
    bool CanAddPhysical { get; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    In other words, whether the filesystem can copy/move a file that is on local disk, in a fast and efficient way.

    Methods

    View Source

    AddFile(String, Stream)

    Adds a file to the file system.

    Declaration
    void AddFile(string path, Stream stream)
    Parameters
    Type Name Description
    System.String path

    The path to the given file.

    Stream stream

    The containing the file contents.

    View Source

    AddFile(String, Stream, Boolean)

    Adds a file to the file system.

    Declaration
    void AddFile(string path, Stream stream, bool overrideIfExists)
    Parameters
    Type Name Description
    System.String path

    The path to the given file.

    Stream stream

    The containing the file contents.

    System.Boolean overrideIfExists

    Whether to override the file if it already exists.

    View Source

    AddFile(String, String, Boolean, Boolean)

    Adds a file which is on a physical filesystem.

    Declaration
    void AddFile(string path, string physicalPath, bool overrideIfExists = true, bool copy = false)
    Parameters
    Type Name Description
    System.String path

    The path to the file.

    System.String physicalPath

    The absolute physical path to the source file.

    System.Boolean overrideIfExists

    A value indicating what to do if the file already exists.

    System.Boolean copy

    A value indicating whether to move (default) or copy.

    View Source

    DeleteDirectory(String)

    Deletes the specified directory.

    Declaration
    void DeleteDirectory(string path)
    Parameters
    Type Name Description
    System.String path

    The name of the directory to remove.

    View Source

    DeleteDirectory(String, Boolean)

    Deletes the specified directory and, if indicated, any subdirectories and files in the directory.

    Declaration
    void DeleteDirectory(string path, bool recursive)
    Parameters
    Type Name Description
    System.String path

    The name of the directory to remove.

    System.Boolean recursive

    Whether to remove directories, subdirectories, and files in path.

    Remarks

    Azure blob storage has no real concept of directories so deletion is always recursive.

    View Source

    DeleteFile(String)

    Deletes the specified file.

    Declaration
    void DeleteFile(string path)
    Parameters
    Type Name Description
    System.String path

    The name of the file to remove.

    View Source

    DirectoryExists(String)

    Determines whether the specified directory exists.

    Declaration
    bool DirectoryExists(string path)
    Parameters
    Type Name Description
    System.String path

    The directory to check.

    Returns
    Type Description
    System.Boolean

    True if the directory exists and the user has permission to view it; otherwise false.

    View Source

    FileExists(String)

    Determines whether the specified file exists.

    Declaration
    bool FileExists(string path)
    Parameters
    Type Name Description
    System.String path

    The file to check.

    Returns
    Type Description
    System.Boolean

    True if the file exists and the user has permission to view it; otherwise false.

    View Source

    GetCreated(String)

    Gets the created date/time of the file, expressed as a UTC value.

    Declaration
    DateTimeOffset GetCreated(string path)
    Parameters
    Type Name Description
    System.String path

    The path to the file.

    Returns
    Type Description
    DateTimeOffset

    .

    View Source

    GetDirectories(String)

    Gets all directories matching the given path.

    Declaration
    IEnumerable<string> GetDirectories(string path)
    Parameters
    Type Name Description
    System.String path

    The path to the directories.

    Returns
    Type Description
    IEnumerable<System.String>

    The representing the matched directories.

    View Source

    GetFiles(String)

    Gets all files matching the given path.

    Declaration
    IEnumerable<string> GetFiles(string path)
    Parameters
    Type Name Description
    System.String path

    The path to the files.

    Returns
    Type Description
    IEnumerable<System.String>

    The representing the matched files.

    View Source

    GetFiles(String, String)

    Gets all files matching the given path and filter.

    Declaration
    IEnumerable<string> GetFiles(string path, string filter)
    Parameters
    Type Name Description
    System.String path

    The path to the files.

    System.String filter

    A filter that allows the querying of file extension. *.jpg

    Returns
    Type Description
    IEnumerable<System.String>

    The representing the matched files.

    View Source

    GetFullPath(String)

    Gets the full qualified path to the file.

    Declaration
    string GetFullPath(string path)
    Parameters
    Type Name Description
    System.String path

    The file to return the full path for.

    Returns
    Type Description
    System.String

    The System.String representing the full path.

    View Source

    GetLastModified(String)

    Gets the last modified date/time of the file, expressed as a UTC value.

    Declaration
    DateTimeOffset GetLastModified(string path)
    Parameters
    Type Name Description
    System.String path

    The path to the file.

    Returns
    Type Description
    DateTimeOffset

    .

    View Source

    GetRelativePath(String)

    Returns the application relative path to the file.

    Declaration
    string GetRelativePath(string fullPathOrUrl)
    Parameters
    Type Name Description
    System.String fullPathOrUrl

    The full path or URL.

    Returns
    Type Description
    System.String

    The System.String representing the relative path.

    View Source

    GetSize(String)

    Gets the size of a file.

    Declaration
    long GetSize(string path)
    Parameters
    Type Name Description
    System.String path

    The path to the file.

    Returns
    Type Description
    System.Int64

    The size (in bytes) of the file.

    View Source

    GetUrl(String)

    Returns the application relative URL to the file.

    Declaration
    string GetUrl(string path)
    Parameters
    Type Name Description
    System.String path

    The path to return the URL for.

    Returns
    Type Description
    System.String

    System.String representing the relative URL.

    View Source

    OpenFile(String)

    Gets a representing the file at the given path.

    Declaration
    Stream OpenFile(string path)
    Parameters
    Type Name Description
    System.String path

    The path to the file.

    Returns
    Type Description
    Stream

    .

    • Improve this Doc
    • View Source
    In This Article
    • Properties
      • CanAddPhysical
    • Methods
      • AddFile(String, Stream)
      • AddFile(String, Stream, Boolean)
      • AddFile(String, String, Boolean, Boolean)
      • DeleteDirectory(String)
      • DeleteDirectory(String, Boolean)
      • DeleteFile(String)
      • DirectoryExists(String)
      • FileExists(String)
      • GetCreated(String)
      • GetDirectories(String)
      • GetFiles(String)
      • GetFiles(String, String)
      • GetFullPath(String)
      • GetLastModified(String)
      • GetRelativePath(String)
      • GetSize(String)
      • GetUrl(String)
      • OpenFile(String)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX