Skip to main content

Posts

Showing posts with the label append

Append a txt file to another txt file

Copy this method to your Global Class in AX. public static void appendTextFile(str fromFilePath,str toFilePath) {     FileIOPermission fromPerm;     FileIOPermission toPerm;     System.String text;     System.IO.FileStream fs;     System.IO.StreamReader reader;     ;     if(System.IO.File::Exists(fromFilePath) && System.IO.File::Exists(toFilePath))     {          // Read text from file         reader = new System.IO.StreamReader(fromFilePath);         text = reader.ReadToEnd();         reader.Close();         // Append         System.IO.File::AppendAllText(toFilePath,text);     }     else     {         throw error("Invalid path or file does not exist");     } }