Skip to content

hannesbarbez/BarbezDotEu.FileIO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BarbezDotEu.FileIO

Misc. logic related to files and IO.

Contents

DirectoryDumper type

BarbezDotEu.FileIO

Basic, static class for "dumping"/listing information for a given folder/directory.

ListFilesInFile(directory,fileName) method

Creates or overwrites a text file containing a list of fully qualified file names found inside a given directory.

Parameters
Name Type Description
directory System.String The directory to investigate.
fileName System.String The text file to write the information to.

DirectoryMerger type

BarbezDotEu.FileIO

Basic class implementing static methods pertaining to merging of folders/directories.

MergeFilesFromSubDirectoryIntoRootDirectory(rootDirectory,deleteSubDirectoriesOnFinish) method

Moves all files, found in any subdirectories a given root directory, into the root directory.

Parameters
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.

DirectorySplitter type

BarbezDotEu.FileIO

Splits (the contents of) a directory.

FillTextToLength(text,desiredLength,filler) method

Prefixes a text with a filler from which a string with a certain length is returned.

Returns

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.

Parameters
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.

MoveFilesIntoSubDirectories(rootDirectory,itemsPerSubFolder) method

In a best-effort kind of a way, moves files in a directory into subdirectories created on the fly.

Parameters
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.

DiskIO type

BarbezDotEu.FileIO

Basic class implementing static methods pertaining to file persisting to disk.

SaveText(filename,text,directory,timestampPrefix) method

Saves a given text to a given filename.

Returns

The fully-qualified path of where the file was created.

Parameters
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.

WriteLine(path,line) method

Appends a line of text to a text file.

Parameters
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.

Author

www.barbez.eu