As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
// Location of log file report var dest = companyhome.childByNamePath("Sites/myoffice/documentLibrary/AURC Space/DEO/Reports") ; // Create new log file and add heading logFile = dest.createFile("log.txt") ; logFile.content = "Record of which files failed transformation" + "\r\n" ; // Start iterating over all files in Drafts folder and transform each, one by one var draftfolder = companyhome.childByNamePath("Sites/myoffice/documentLibrary/AURC Space/DEO/Drafts") ; var childfiles = draftfolder.children ; var filenumb = childfiles.length ; var count = 0 ; // Go through each file, one by one for ( i = 0 ; i < filenumb ; i++ ) { var docu = childfiles[i] ; var newtxtNode ; try { newtxtNode = docu.transformDocument("text/plain") ; newtxtNode.save() ; } catch (e) { logFile.content += ++count + " Error in transformation: " + docu.name ; } } // end of for loop logFile.save() ;
Or another option could be to queue actions to do the transformations asynchronously. That's possibly a much better approach.