-
Notifications
You must be signed in to change notification settings - Fork 1
Class CSharpLib.Files
Samuel edited this page May 16, 2021
·
1 revision
This class contains methods for advanced file actions. The current methods are listed below:
Compress(FileInfo fileToCompress);
Decompress(FileInfo fileToDecompress);
GetFileSize(string file);
GetDirectorySize(DirectoryInfo d);
The method Compress() compresses a file into a compressed file format (.gz extension), and Decompress() decompresses the specified compressed file. The method GetFileSize() returns the size, in bytes, of the specified file, and GetDirectorySize() returns the byte size of a given directory.
-
RenameFile(string name, string newName)
- Renames a file.
-
FormatBytes(this FileInfo info)
- Returns a formatted string representing the size, up to TB, of the file defined in the FileInfo instance (i.e. 10 KB). -
RemoveAttribute(this FileInfo info, FileAttributes attributeToRemove)
- Removes an attribute from the file defined in the FileInfo instance. -
SetAttribute(this FileInfo info, FileAttributes attributeToAdd)
- Adds an attribute to the file defined in the FileInfo instance. -
GetFileSizeOnDisk(this FileInfo file)
- Gets the size, in bytes, of the file on disk.