cancel
Showing results for 
Search instead for 
Did you mean: 

Serious With Script in Alfresco !

vinaxwater
Champ in-the-making
Champ in-the-making
I have a file script for Run Action >> Execute a script :


   var fileOutput = space.childByNamePath("fileOutput.txt");
   if (fileOutput == null) {
      fileOutput = space.createFile("fileOutput.txt");
   }
   
   var query = "TYPE:\"{http://www.alfresco.org/model/content/1.0}person\"";
   var Results = search.luceneSearch(query);
   
        for ( var i = 0; i < Results.length; i++) {
         var pers = Results[i].properties["cm:userName"];
              fileOutput.content = fileOutput.content + "\r\n" + pers;
       }

That code is get all Users in My Alfresco System write into fileOutput.txt. I have 500 Users in System Alfresco When I run that file script Alfresco create a file fileOutput.txt, at the same time system create file .bin in folder "alf_data/30/06/14/15" (it's mean script run in 14h15m), i have 500 user will create 500 file .bin in that folder  :shock: . If in case script not correct i repair it and run again, I can run 20 time for this script with 500 user in system when i have 500x20 file .bin created.

WHY I DELETED FILE fileOutput.txt BUT FILES .bin IN FOLDER NOT DELETE ??? IF IT'S NOT DELETE FILE .bin THAT SERIOUS BECAUSE IN 1H I USED 30GB HDD AND MY SYSTEM DIE WITH HDD FULL :shock:

Regards and Thanks
vinaxwater
6 REPLIES 6

lyamamot
Champ in-the-making
Champ in-the-making
Instead of writing:

for ( var i = 0; i < Results.length; i++) {
         var pers = Results[i].properties["cm:userName"];
              fileOutput.content = fileOutput.content + "\r\n" + pers;
       }

… why not try collecting your output in a temporary variable and then assigning it to the content? Otherwise, every time you update fileOutput.content, Alfresco will create a new version of your file. A new version probably means a new .bin file in your data directory.


var content = '';
for ( var i = 0; i < Results.length; i++) {
         var pers = Results[i].properties["cm:userName"];
         content += "\r\n" + pers;
}

fileOutput.content += content;

vinaxwater
Champ in-the-making
Champ in-the-making
Thanks for reply me. I know that but i must repairing and executing file script not one time in day, i want those .bin remove when i deleted that file fileOutput.txt

jpfi
Champ in-the-making
Champ in-the-making

lista
Star Contributor
Star Contributor
Hi,

we can go around that by adding temporary aspect to the node before deleting it.
This way, it will be completely deleted right away.

There's also a <archive> tag that we can set to false when designing our model.
This will also result with the same thing.

Cheers,
Lista.

vinaxwater
Champ in-the-making
Champ in-the-making
Hi All,
I want disable feature create new file .bin in /alt_data when i update content because i use cifs in alfresco from url: \\serverAlfresco:8080\alfresco it's create file .bin for new version when i paste files exist  :roll:

Thanks for read and Regards

mikeh
Star Contributor
Star Contributor
Hi All,
I want disable feature create new file .bin in /alt_data when i update content because i use cifs in alfresco from url: \\serverAlfresco:8080\alfresco it's create file .bin for new version when i paste files exist  :roll:

Thanks for read and Regards
Firstly, please start a new topic for an unrelated issue, don't tack it onto an existing one.

Secondly: what? Alfresco will create a new .bin file because it's a new version. It has to keep the old version in case you want to roll back. The fact the you use CIFS is not relevant.

Thanks,
Mike