• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class FileSystemUtils

File System utilities.

Inheritance
System.Object
FileSystemUtils
Namespace: DotNetNuke.Common.Utilities
Assembly: DotNetNuke.dll
Syntax
public class FileSystemUtils : object

Methods

| Improve this Doc View Source

AddToZip(ref ZipArchive, String, String, String)

Adds a File to a Zip File.

Declaration
public static void AddToZip(ref ZipArchive zipFile, string filePath, string fileName, string folder)
Parameters
Type Name Description
ZipArchive zipFile

The Zip File to add to.

System.String filePath

The path to the file to add.

System.String fileName

The name of the file to add.

System.String folder

The name of the folder to use for the zip entry.

| Improve this Doc View Source

AddToZip(ref ZipOutputStream, String, String, String)

Adds a file to a zip.

Declaration
public static void AddToZip(ref ZipOutputStream zipFile, string filePath, string fileName, string folder)
Parameters
Type Name Description
ZipOutputStream zipFile

The zip file stream to add to.

System.String filePath

The path to the file to add.

System.String fileName

Name of the file to use in the zip entry.

System.String folder

The name of the folder to use in the zip entry..

| Improve this Doc View Source

CopyFile(String, String)

Tries to copy a file in the file system.

Declaration
public static void CopyFile(string sourceFileName, string destFileName)
Parameters
Type Name Description
System.String sourceFileName

The name of the source file.

System.String destFileName

The name of the destination file.

| Improve this Doc View Source

DeleteEmptyFoldersRecursive(String)

Deletes all empty folders beneath a given root folder and the root folder itself as well if empty.

Declaration
public static void DeleteEmptyFoldersRecursive(string path)
Parameters
Type Name Description
System.String path

The root folder path.

| Improve this Doc View Source

DeleteFile(String)

Tries to delete a file from the file system.

Declaration
public static void DeleteFile(string fileName)
Parameters
Type Name Description
System.String fileName

The name of the file.

| Improve this Doc View Source

DeleteFiles(Array)

Deletes the files specified.

Declaration
public static string DeleteFiles(Array arrPaths)
Parameters
Type Name Description
Array arrPaths

An array of the file paths for the files to delete..

Returns
Type Description
System.String

An empty string if succeeded or a list of errors in case of failures.

| Improve this Doc View Source

DeleteFilesRecursive(String, String)

Deletes files that match a filter recursively within folders.

Declaration
public static void DeleteFilesRecursive(string strRoot, string filter)
Parameters
Type Name Description
System.String strRoot

The root path to filter from.

System.String filter

The filter to select the files to delete.

| Improve this Doc View Source

DeleteFileWithWait(String, Int16, Int16)

Deletes file in areas with a high degree of concurrent file access (i.e. caching, logging). This solves file concurrency issues under heavy load.

Declaration
public static bool DeleteFileWithWait(string fileName, short waitInMilliseconds, short maxAttempts)
Parameters
Type Name Description
System.String fileName

The file name.

System.Int16 waitInMilliseconds

The number of milliseconds to wait.

System.Int16 maxAttempts

The maximum number of attempts.

Returns
Type Description
System.Boolean

Whether the file is deleted.

| Improve this Doc View Source

DeleteFolderRecursive(String)

Deletes a folder and all it's child files and folders.

Declaration
public static void DeleteFolderRecursive(string strRoot)
Parameters
Type Name Description
System.String strRoot

The root path to delete from.

| Improve this Doc View Source

FixPath(String)

Fixes the path in case the path separator is not windows style.

Declaration
public static string FixPath(string input)
Parameters
Type Name Description
System.String input

The path to fix.

Returns
Type Description
System.String

A valid Windows path.

| Improve this Doc View Source

ReadFile(String)

Reads a file.

Declaration
public static string ReadFile(string filePath)
Parameters
Type Name Description
System.String filePath

The file path.

Returns
Type Description
System.String

The string content of the file.

| Improve this Doc View Source

UnzipResources(ZipArchive, String)

Unzips a resources zip file.

Declaration
public static void UnzipResources(ZipArchive zipStream, string destPath)
Parameters
Type Name Description
ZipArchive zipStream

The zip archive stream.

System.String destPath

The destination path to extract to.

| Improve this Doc View Source

UnzipResources(ZipInputStream, String)

Unzips a resources zip file.

Declaration
public static void UnzipResources(ZipInputStream zipStream, string destPath)
Parameters
Type Name Description
ZipInputStream zipStream

The zip stream.

System.String destPath

The destination path to extract to.

Extension Methods

JsonExtensionsWeb.ToJson(Object)
  • View Source
Back to top by the community, for the community... #DNNCMS