Misc. logic related to files and IO.
BarbezDotEu.FileIO
Basic, static class for "dumping"/listing information for a given folder/directory.
Creates or overwrites a text file containing a list of fully qualified file names found inside a given directory.
Name | Type | Description |
---|---|---|
directory | System.String | The directory to investigate. |
fileName | System.String | The text file to write the information to. |
BarbezDotEu.FileIO
Basic class implementing static methods pertaining to merging of folders/directories.
Moves all files, found in any subdirectories a given root directory, into the root directory.
Name | Type | Description |
---|---|---|
rootDirectory | System.String | The root directory where all files in its subdirectories should be moved into. |
deleteSubDirectoriesOnFinish | System.Boolean | Set to true to delete the actual subdirectories after all files have been moved. Set to false to keep the (potentially empty) subdirectories. |
BarbezDotEu.FileIO
Splits (the contents of) a directory.
Prefixes a text with a filler from which a string with a certain length is returned.
The given text prefixed with a filler from which a string with a certain length is returned. Returns the initial text if it is longer than the provided length.
Name | Type | Description |
---|---|---|
text | System.String | The text to prefix. |
desiredLength | System.Int64 | The desired length of the returned string. |
filler | System.Char | The filler to use in prefixing the text. |
In a best-effort kind of a way, moves files in a directory into subdirectories created on the fly.
Name | Type | Description |
---|---|---|
rootDirectory | System.String | The relative or absolute path to the directory to search. This string is not case-sensitive. |
itemsPerSubFolder | System.Int32 | The maximum number of items per subdirectory. |
BarbezDotEu.FileIO
Basic class implementing static methods pertaining to file persisting to disk.
Saves a given text to a given filename.
The fully-qualified path of where the file was created.
Name | Type | Description |
---|---|---|
filename | System.String | The name of the file to store. |
text | System.String | The textual contents of the file. |
directory | System.String | The directory where to store the file on disk. |
timestampPrefix | System.DateTime | The DateTime to prepend the given filename with, if any. |
Appends a line of text to a text file.
Name | Type | Description |
---|---|---|
path | System.String | The full file path (i.e. incl. folder and file name + extension) to append the line to. |
line | System.String | The line to append to the text file. |