<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: script in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/script/m-p/269781#M222911</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have answered this on stackoverflow as well. Going forward, please ask questions here or there but not both…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The script as written would take a document named "filename.bin" and rename it to "filename.bin.pdf". It would then set a property called "cm:locale" equal to the value of mylocalenode, which appears to be undefined in this snippet. I don't know what you are going for with the cm:locale so I will ignore that and give you a script that will search for the document named filename.bin and change its name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you would rather iterate over the children in a folder, you should be able to look at the Alfresco JavaScript API to figure out how to modify the snippet below to do that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;var results = search.luceneSearch("@cm\\:name:filename.bin");&lt;BR /&gt;var doc = results[0]; // assumes there is only one result, which may not be what you want&lt;BR /&gt;var oldName = doc.properties.name;&lt;BR /&gt;var newName = oldName.replace('.bin', '.pdf');&lt;BR /&gt;doc.properties.name = newName;&lt;BR /&gt;doc.save();&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jul 2012 22:57:25 GMT</pubDate>
    <dc:creator>jpotts</dc:creator>
    <dc:date>2012-07-25T22:57:25Z</dc:date>
    <item>
      <title>script</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/script/m-p/269780#M222910</link>
      <description>I am trying to create a script to rename all files in a space. The file extension is filename.binI want to rename it to filename.pdf without doing any other process on the fileSo far I have tried the following script but without any luck————–// change the name of this document&amp;nbsp; document.properties.n</description>
      <pubDate>Wed, 25 Jul 2012 17:33:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/script/m-p/269780#M222910</guid>
      <dc:creator>edwardlobo</dc:creator>
      <dc:date>2012-07-25T17:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/script/m-p/269781#M222911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have answered this on stackoverflow as well. Going forward, please ask questions here or there but not both…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The script as written would take a document named "filename.bin" and rename it to "filename.bin.pdf". It would then set a property called "cm:locale" equal to the value of mylocalenode, which appears to be undefined in this snippet. I don't know what you are going for with the cm:locale so I will ignore that and give you a script that will search for the document named filename.bin and change its name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you would rather iterate over the children in a folder, you should be able to look at the Alfresco JavaScript API to figure out how to modify the snippet below to do that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;var results = search.luceneSearch("@cm\\:name:filename.bin");&lt;BR /&gt;var doc = results[0]; // assumes there is only one result, which may not be what you want&lt;BR /&gt;var oldName = doc.properties.name;&lt;BR /&gt;var newName = oldName.replace('.bin', '.pdf');&lt;BR /&gt;doc.properties.name = newName;&lt;BR /&gt;doc.save();&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jul 2012 22:57:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/script/m-p/269781#M222911</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2012-07-25T22:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/script/m-p/269782#M222912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Many thanks Jeff&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was trying to do scanned pdf to image pdf however because transformation only works from one file type to another I used the ocr utility to scan pdf into a pdf but with bin extension.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I then wanted to just change the filename to .pdf by either using a bin to pdf transformation with ren or via a java script as a rule once a *.bin file lands into a folder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I created the script you gave me and created a rule saying when the filename contains *.bin execute the script. Is there any other step I missed&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jul 2012 09:08:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/script/m-p/269782#M222912</guid>
      <dc:creator>edwardlobo</dc:creator>
      <dc:date>2012-07-26T09:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/script/m-p/269783#M222913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes.&amp;nbsp; Please note that transformation is done on mime type, not file name.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Changing the name of a file will not / should not change the mimetype.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You may want to look at doing a "rendition" rather than a "transformation".&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jul 2012 09:57:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/script/m-p/269783#M222913</guid>
      <dc:creator>mrogers</dc:creator>
      <dc:date>2012-07-26T09:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: script</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/script/m-p/269784#M222914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have almost the same problem. I don't want to change these .bin but I would like to move them in the same file, directly in the contentstore.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a file where I can modify that?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jun 2013 14:50:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/script/m-p/269784#M222914</guid>
      <dc:creator>thomasbzh</dc:creator>
      <dc:date>2013-06-25T14:50:55Z</dc:date>
    </item>
  </channel>
</rss>

