Class FilesAndFolders
- Namespace
- Dynamicweb.Content.Files
- Assembly
- Dynamicweb.dll
This class contains the functions to handle whith files and folders.
[Obsolete("Do not use")]
public class FilesAndFolders
- Inheritance
-
FilesAndFolders
- Inherited Members
Methods
CopyFile(string, string)
Copy the current file to another location.
public static OperationReport CopyFile(string file, string destination)
Parameters
Returns
CopyFileBrowser(string, string)
Copy the current file to another location.
public static OperationReport CopyFileBrowser(string file, string destination)
Parameters
Returns
CopyFiles(string[], string)
Copy the current file to the destination file.
public static OperationReport CopyFiles(string[] files, string destinationFolder)
Parameters
Returns
Remarks
If operation is succeeded then calls the logger.
CopyFolder(string, string)
Copy current folder and all its subfolders and subfiles to another location with permissions.
public static OperationReport CopyFolder(string folder, string destination)
Parameters
Returns
CopyFolder(string, string, ref string)
Copy current folder and all its subfolders and subfiles to another location with permissions.
public static OperationReport CopyFolder(string folder, string destination, ref string resultingFolderPath)
Parameters
Returns
CopyFolders(string, string)
[Obsolete("Use CopyFolder instead.")]
public static OperationReport CopyFolders(string folder, string destination)
Parameters
Returns
CopyFolders(string, string, ref string)
[Obsolete("Use CopyFolder instead.")]
public static OperationReport CopyFolders(string folder, string destination, ref string destFolderPath)
Parameters
Returns
CreateFile(string, bool)
Creates the new file.
public static OperationReport CreateFile(string file, bool template)
Parameters
Returns
CreateFolder(string, string)
[Obsolete("Use MakeFolder instead.")]
public static OperationReport CreateFolder(string folder, string newfolder)
Parameters
Returns
DeleteFile(string)
Simply moves the current file to another location.
public static OperationReport DeleteFile(string file)
Parameters
file
string- Phisical path to the current file.
Returns
DeleteFiles(string[])
Simply moves the current files of array to another location.
public static OperationReport DeleteFiles(string[] files)
Parameters
files
string[]- Current array of files.
Returns
DeleteFolder(string)
Deletes the current folder.
[Obsolete("Use DeleteFolders instead")]
public static OperationReport DeleteFolder(string folder)
Parameters
folder
string- Current folder.
Returns
Remarks
If operation is succeeded then calls the logger.
DeleteFolders(string)
Deletes current folder and all its subfolders and files.
public static OperationReport DeleteFolders(string folder)
Parameters
folder
string
Returns
GetFileEncoding(string, ref Encoding)
Returns the file encoding.
public static string GetFileEncoding(string filePath, ref Encoding encoding)
Parameters
filePath
string- The physical path and name of the file.
encoding
Encoding- Reference to the encoding to set.
Returns
Remarks
Reads the first bytes of a file to determined the file encoding.
GetFilesFolderName()
Gets the name of the files folder. I.e "Filer" in /Files/Filer/
[Obsolete("Use 'Files' instead.")]
public static string GetFilesFolderName()
Returns
Remarks
Specified in GlobalSettings.aspx/config - /Globalsettings/System/Filesystem/FilesFolderName. Default value is "Filer"
GetFileSizeKb(double)
Converts bytes to KB string with 2 decimals for UI displaying purpose
public static string GetFileSizeKb(double fileSize)
Parameters
fileSize
double- The filesize in bytes.
Returns
GetFullFilePath(string)
Returns the full phisical path to the current file.
public static string GetFullFilePath(string file)
Parameters
file
string- Current file.
Returns
GetImagesFolderName()
Gets the name of the image folder. I.e "Billeder" in /Files/Billeder/
[Obsolete("Use 'Images' instead.")]
public static string GetImagesFolderName()
Returns
Remarks
Specified in GlobalSettings.aspx/config - /Globalsettings/System/Filesystem/ImagesFolderName. Default value is "Billeder"
GetValidFileAndFolderName(string)
Gets the name of the valid file and folder.
public static string GetValidFileAndFolderName(string folderName)
Parameters
folderName
string- Name of the folder.
Returns
IsValidFileAndFolderName(string)
Determines whether [is valid file and folder name] [the specified folder name].
public static bool IsValidFileAndFolderName(string folderName)
Parameters
folderName
string- Name of the folder.
Returns
- bool
true
if [is valid file and folder name] [the specified folder name]; otherwise,false
.
MakeFolder(string, string)
Creates a new folder.
public static OperationReport MakeFolder(string destination, string folderName)
Parameters
Returns
MoveFile(string, string)
Moves the current file to the destination file.
public static OperationReport MoveFile(string file, string destinationFolder)
Parameters
Returns
MoveFiles(string[], string)
Moves the current file to the destination file.
public static OperationReport MoveFiles(string[] files, string destinationFolder)
Parameters
Returns
Remarks
Overloads.The overwrite parameter is False.
MoveFiles(string[], string, bool)
Moves the current file to the destination file.
public static OperationReport MoveFiles(string[] files, string destinationFolder, bool overwrite)
Parameters
files
string[]- File to move.
destinationFolder
string- Where to move.
overwrite
bool- Whether destination file can be overwrited.
Returns
Remarks
If operation is succeeded then calls the logger.
MoveFolder(string, string)
Moves current folder and all its subfolders and subfiles to another location.
public static OperationReport MoveFolder(string folder, string destination)
Parameters
Returns
Remarks
If operation is succeeded then calls the logger.
MoveFolders(string, string)
Moves current folder and all its subfolders and subfiles to another location with permissions.
public static OperationReport MoveFolders(string folder, string destination)
Parameters
Returns
NormalizeFileName(string)
Normalize fille name.
public static string NormalizeFileName(string fileName)
Parameters
fileName
string- The original name of the file.
Returns
Remarks
Reads the first bytes of a file to determined the file encoding.
ReadTextFile(string)
Reads the current text file.
public static string ReadTextFile(string file)
Parameters
file
string- Current text file.
Returns
- string
- The string with file's text. Or "File does not exist".
RenameFile(string, string)
Renames the current file.
public static OperationReport RenameFile(string file, string newName)
Parameters
Returns
RenameFolder(string, string)
Renames the current folder.
public static OperationReport RenameFolder(string folder, string newName)
Parameters
Returns
Remarks
If operation is succeeded then calls the logger.
RestoreFile(string)
Restore file.
public static OperationReport RestoreFile(string file)
Parameters
file
string
Returns
Remarks
If operation is succeeded then calls the logger.
RestoreFiles(string[])
Restore all files of the current array.
public static OperationReport RestoreFiles(string[] files)
Parameters
files
string[]- The current array of files.
Returns
Remarks
If operation is succeeded then calls the logger.
TrimLongFileName(string, string, string)
public static string TrimLongFileName(string longFileName, string extension, string folderPath)
Parameters
Returns
TrueDeleteFiles(string[])
Deletes all files of the current array.
public static OperationReport TrueDeleteFiles(string[] files)
Parameters
files
string[]- Current array of files.
Returns
TryMakeWritable(string)
Tries to make the given file writable.
public static bool TryMakeWritable(string path)
Parameters
path
string- Physical path to the file.
Returns
- bool
- Value indicating whether file has been successfully made writable.
ValidateFilename(string)
Checks if the fileNameWithPath contains any characters that are illegal in a filename
public static bool ValidateFilename(string fileNameWithPath)
Parameters
fileNameWithPath
string- The file name with it's path.
Returns
- bool
- True if fileNameWithPath contains no illegal characters and is valid, otherwise False
WriteTextFile(string, string)
Writes text to the current file.
public static OperationReport WriteTextFile(string file, string text)