AnsweredAssumed Answered

Issue when writting on files

Question asked by ediez on May 19, 2008
Latest reply on May 24, 2008 by sacco

I'm calling a set of methods from the Javascript API to create and write on a text file.

I'm adding a new entry to a text file on a loop, the thing is that every time I write on the file, a new file is being created in the repository. The file has almost 11.000 entries, so that would mean over 10.000 files in my repository.

Does anyone know which method I should call in order to avoid this?

Here's the code snipped.

// log the docs that currently contain the word 'Alfresco' to a log file
var logFile = userhome.childByNamePath("alf docs.txt");
if (logFile == null)
   logFile = userhome.createFile("alf docs.txt");
if (logFile != null)
   // execute a lucene search across the repo for the text 'alfresco'
   var docs = search.luceneSearch("TEXT:alfresco");
   var log = "";
   for (var i=0; i<docs.length; i++)
      log += "Name: " + + "\tPath: " + docs.displayPath + "\r\n";
   logFile.content += log;