Skip to main content

Utils.File

class Utils.File

Method Inventory

Methods

classmethod CopyFile(origname As %String, newname As %String) as %Status
classmethod DeleteDirIfEmpty(targetdir)
classmethod DeleteFile(filename As %String, verbose As %Boolean = 0)
Deletes the given filename if possible; logs an error if not (DBMTables.ActivityLog).
classmethod DeleteFilesInDirectory(dir As %String, verbose As %Boolean = 1) as %Status
Delete all files within the given directory. Does not affect items of other types that may be in the directory (e.g. subdirectories)
classmethod EndBatchFile(file As %Library.File)
classmethod EndErrorsFile(writer As %XML.Writer, reportfilename="", verbose As %Boolean = 0)
classmethod GenerateFileFromHTML(fullFilename As %String = "", html As %String = "", verbose)
classmethod GenerateListOfFilesFromHTML(listoffilenames As %List, html, verbose As %Boolean)
classmethod GetFirstLine(filename As %String) as %String
Given the name of a file, return the first line in the file
classmethod GetSubdirectoryPaths(directory As %String) as %DynamicArray
Given a directory, return a dynamic array containing the paths to all subdirectories within that directory.
classmethod MakeWindowsFile(filename As %String = "", verbose As %Boolean = 0)
Given the name of a file that has Unix line endings, create a new file that has Windows line endings
classmethod SetUpFile(filename As %String, verbose As %Boolean = 0, unicode As %Boolean = 0) as %Library.File
given a filename, create a file object, try to open the file, and return a handle to the file object
classmethod StartBatchFile(file As %Library.File, caller As %String = "", callingClass As %String = "", verbose As %Boolean = 0, forTechServices As %Boolean = 0)
classmethod StartErrorsFile(reportfilename="", verbose As %Boolean = 0) as %XML.Writer
Starts an errors XML file and returns an OREF to the %XML.Writer that is generating it
classmethod WriteFileGenerator(inputFilename As %String = "C:\TEMP\test.txt")
classmethod WriteFileIntoFile(fileInstance As %File = "", fileToRead As %String = "")
This method reads the contents of the file whose name is given by fileToRead and writes that content, line by line, into fileInstance, which is an instance of %File, presumed to be open.
FeedbackOpens in a new tab