Class Reference
IRIS for UNIX 2024.1.2
InterSystems: The power behind what matters   
Documentation  Search
  [USER] >  [apptools] >  [core] >  [files]
Private  Storage   

abstract class apptools.core.files

Utilities working with files

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
36


Summary

Methods
Alert AlertDays CheckIntegFile ExpansionDB
Export2CSV File2Arr FindContextInLog GetAllDir
GetContextForAlert GetContextForAlertExclude GetFileIdView GetJournalFiles
GetList GetUzipCommand LoadXML OneDayJournalCount
OneJournalCount OpenFile ReadFile ReadFile2Arr
RemoveFiles Stream2Log Stream2String Test
TransXLS2CSV UnzipToDirectory Write2File WriteLog
XlsxTransChoiceLotResult getDate getPathcconsole getPeriod
getSlash tempDir tempGN zipFile


Methods

• classmethod Alert(Line, ByRef bd, hdt)
Search important events
• classmethod AlertDays(Line, ByRef bd, dt)
Search important events
• classmethod CheckIntegFile(file, log) as %Status
d ##class(apptools.core.files).CheckIntegFile("/iris-backup/integrity/2023-03-03-EIS.log",.log)
• classmethod ExpansionDB(Line, ByRef bd, hdt)
Search of time of the extension of the database
• classmethod Export2CSV(aFileName=$$$EMAILXLSPATH_"JrnCount*.csv", tmpGN=$$$TEMPJRNL, aCharset="CP1251")
Export to CSV file d ##class(apptools.core.files).Export2CSV("/iris-backup/temp/JrnCount*.csv","^tmpJRN2")
• classmethod File2Arr(file, Mas, Param="RSU") as %Status
To read a file and write to global w ##class(apptools.core.files).File2Arr("/iris-backup/eaist/work/SPGZ.xml_2018-05-07_14.56.26.461","^tmpFile")
• classmethod FindContextInLog(days, method, bd)
To execute the method on each line of Protocol
• classmethod GetAllDir(dir, ext="", ByRef out)
Get all files in a directory and subdirectories d ##class(apptools.core.files).GetAllDir("d:\dev\app1\src\",,.a) ext = "*.jpg;*.jpeg;*.3gp"
• classmethod GetContextForAlert()
• classmethod GetContextForAlertExclude()
• classmethod GetFileIdView(FileName, gn="", ContentType="") as %String
%request.Application_"get-files/"_id
• classmethod GetJournalFiles(count=1, ByRef list, ByRef Average)
do ##class(apptools.core.files).GetJournalFiles(13,.a,.average)
• classmethod GetList(directory As %String, ext As %String = "*.*", ByRef list) as %Status
Get all files in a directory without subdirectories w ##class(apptools.core.files).GetList("D:\dev\app1\src\","*.xml",.List)
• classmethod GetUzipCommand(file, dir) as %String
• classmethod LoadXML(fn, tag, class)
Loading XML into the feature class d ##class(apptools.core.files).LoadXML("d:\!\InfoObject.xml","infoObject","Model.InfoObject")
• classmethod OneDayJournalCount(fileYYYYMMDD="", tempGlob=$$$TEMPJRNL)
To count in journal which globals as modifierade for a specific date d ##class(apptools.core.files).OneDayJournalCount("/opt/isc/ensemble/mgr/journal/20181225","^tmpJRN") d ##class(apptools.core.files).OneDayJournalCount("/sdb/journals/20181225","^tmpJRN")
• classmethod OneJournalCount(journal="", tempGlob=$$$TEMPJRNL)
Count one journal as what globals modifierade k ^tmpJRN d ##class(apptools.core.files).OneJournalCount("/sdb/journals/20181225.003","^tmpJRN")
• classmethod OpenFile(file, time=1, mode="WNSK", code="UTF8") as %Status
To open a file for writing set fn="/iris-backup/temp/log.txt" if ##class(apptools.core.files).OpenFile(fn) use fn write "test",! close fn
• classmethod ReadFile(filename="/irisdev/app/module.xml", ByRef txt, mute=0, max=$$$MaxStringLength) as %Status
Read file. if ##class(apptools.core.files).ReadFile("/irisdev/app/module.xml",.txt) write txt s f=##class(%File).%New("/irisdev/app/module.xml") if f.Open("RSU") {s t=f.Read() w !,t } else { w $System.Status.GetErrorText($g(%objlasterror)) } d f.%Close() k f
• classmethod ReadFile2Arr(file, mode="RSK", code="UTF8", gn="tmp") as %Status
To open a file and write to the array w ##class(apptools.core.files).ReadFile2Arr("/iris-backup/temp/snmp/ruRunCmd2018-10-03_14:31:00.txt","RSK",,"%tmp") w ##class(apptools.core.files).ReadFile2Arr(fn,"RSK","CP1251",gn)
• classmethod RemoveFiles(pFile As %String, pDir As %String = "") as %Status
• classmethod Stream2Log(aStream, aLogFolder, aFileName, ByRef filename) as %Status
Method unloads the stream aStream into a file folder aLogFolder. aLogFolder - directory of discharge /back/temp/ aFileName - name of the unloaded file File - the full path to the file w ##class(apptools.core.files).Stream2Log(HttpResponse.Data, TempDir, fileName,.File) s aDATA("pathfileName")=$g(path)
• classmethod Stream2String(resp As %Stream, StringValue As %String) as %Status
Stream convert to string w ##class(apptools.core.files).Stream2String(resp,.str)
• classmethod Test(days, res)
do ##class(apptools.core.files).Test(30,.res)
• classmethod TransXLS2CSV(fileXSL, FieldNameHead="QUANTITY", ByRef out, ByRef error, tempDir=##class(%File).GetDirectory(##class(%File).TempFilename()))
Convert XSL file to CSV format and upload to GD d ##class(apptools.core.files).TransXLS2CSV
• classmethod UnzipToDirectory(fileName As %String, Output dirName As %String, cmd) as %Status
Unpack the archive to a directory w ##class(apptools.core.files).UnzipToDirectory("/iris-backup/eaist/imported/3a308a20ff8e271ae3e063231a8df1ad.zip","/iris-backup/eaist/last")
• classmethod Write2File(fn="/tmp/log.txt", ByRef cmd) as %Status
Write to file. Sample run: write ##class(apptools.core.files).Write2File("d:\!\log.txt","do 1^%SS")
• classmethod WriteLog(file, log) as %Status
d ##class(apptools.core.files).WriteLog("/iris-backup/integrity/2023-03-03-err.log",.log)
• classmethod XlsxTransChoiceLotResult(f, node, ParamData, ParamClass, ParamField, debug=0, newfile="", msg="")
Generate the XLSX document template transforming field f - the array of fields to replace ParamData - the name Value of the parameter node - the subnode of a temporary global ParamClass - "Spgz.model.Param" ParamField - field name ;"OfficeFile"
• classmethod getDate(Line, yyyy, mm, dd)
Search of time of the extension of the database
• classmethod getPathcconsole(ByRef dir, ByRef logname)
To the system path Protocol w ##class(apptools.core.files).getPathcconsole()
• classmethod getPeriod(days, FromDateTime, ToDateTime, df, dt) as %String
To date range in number of days from the current w ##class(apptools.core.files).getPeriod(69,.FromDateTime,.ToDateTime,.df,.dt)
• classmethod getSlash() as %String
• classmethod tempDir() as %String
To a temporary directory w ##class(apptools.core.files).tempDir()
• classmethod tempGN(GN, NoKill=0) as %String
To globalnu a reference to a temporary global w ##class(apptools.core.files).tempGN("GN")
• classmethod zipFile(dir, fileName As %String, newfileName As %String, tempdir As %String = "") as %Status
Packaging file in the archive Directory tempdir need to assign write cacheusr >sudo chmod ugo+w .


Copyright (c) 2025 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.