Skip to content

Helpers.SystemOperations

Avrigeanu Laurian edited this page Sep 6, 2022 · 2 revisions

This subclass contains the Files subclass and Folders subclass.

Files

DeleteDuplicateFiles (void)

This method will delete any duplicate files in the specified folder that contain an unique identifier.

Mandatory Parameters Optional Parameters
string folderPath string duplicateIdentifier (default "(")

Example:

Helpers.SystemOperations.DeleteDuplicateFiles("C:\Users\my.user\Desktop\Logs\");

DeleteFile (void)

This method will delete the file at the specified path.

Mandatory Parameters
string filePath

Example:

Helpers.SystemOperations.DeleteFile("C:\Users\my.user\Desktop\Logs\myFile.txt");

CreateFolder (String)

This method will create a folder at the specified path.

Mandatory Parameters
string folderPath

Example:

Helpers.SystemOperations.CreateFolder("C:\Users\my.user\Desktop\Logs\NewFolder");

MoveFile (String)

This method will move a file from a path to another path, optionally renaming the file.

Warning: If the folder you try to move the file to does not exist, this method will throw an Exception.

Mandatory Parameters
string filePath
string directoryPath

Example:

Helpers.SystemOperations.MoveFile("C:\Users\my.user\Desktop\Logs\myFile.txt", "C:\Users\my.user\Desktop\myNewFile.txt");

RenameFile (String)

This method will rename a file at the given path.

Mandatory Parameters
string filePath
string newName

Example:

Helpers.SystemOperations.RenameFile("C:\Users\my.user\Desktop\Logs\myFile.txt", "MyNewFile.txt");

MoveFiles (void)

This method will move a collection of files from a given path.

Mandatory Parameters
List<string> files
string folderPath
string directoryPath

Example:

Helpers.SystemOperations.MoveFiles(ListOfFileNames,"C:\Users\my.user\Desktop\Logs\", "C:\Users\my.user\Desktop\Desktop\");

Folders

FolderContainsFiles (bool)

This method will verify if a specified path contains any files.

Mandatory Parameters
string folderPath

Example:

Helpers.SystemOperations.FolderContainsFiles("C:\Users\my.user\Desktop\Desktop\");

CreateFolder (void)

This method will create a folder at the specified path.

Mandatory Parameters
string path

Example:

Helpers.SystemOperations.CreateFolder("C:\Users\my.user\Desktop\Desktop\NewFolder");

DeleteFolder (void)

This method will delete a folder at the specified path.

Mandatory Parameters
string folderPath

Example:

Helpers.SystemOperations.DeleteFolder("C:\Users\my.user\Desktop\Desktop\NewFolder");

ArchiveFolder (void)

This method will archive a folder at the specified path then move it to a specified path.

Mandatory Parameters
string folderPath
string otherPath

Example:

Helpers.SystemOperations.ArchiveFolder("C:\Users\my.user\Desktop\Desktop\NewFolder", "C:\Users\my.user\Desktop\Desktop");