<?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 to copy documents to a relevant folder in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63259#M21746</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How did you write the code you already have? It shouldn't need a sample to make two or three small adjustments to the code if you have written it yourself. I recommend you make yourself familiar with the &lt;A href="https://docs.alfresco.com/5.2/references/API-JS-ScriptNode.html" rel="nofollow noopener noreferrer"&gt;ScriptNode API&lt;/A&gt;&amp;nbsp;if you are unsure about which properties / functions to call. Specifically you should only need to use the childFileFolders() function and the name property to deal with the contents of the COMMISSION_MEETINGS folder and filter by name..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Mar 2018 17:12:45 GMT</pubDate>
    <dc:creator>afaust</dc:creator>
    <dc:date>2018-03-13T17:12:45Z</dc:date>
    <item>
      <title>Script to copy documents to a relevant folder</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63256#M21743</link>
      <description>Hi, I am using Alfresco Community 5.2 and i need to create a script to copy document to a relevant folder.&amp;nbsp;copy-to-rel-folder.js&amp;nbsp;var createdDate = document.properties["cm:created"];var dd = createdDate.getDate();var mm = createdDate.getMonth()+1; //January is 0!var yyyy = createdDate.getFullYear();i</description>
      <pubDate>Mon, 12 Mar 2018 09:38:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63256#M21743</guid>
      <dc:creator>anuradha1</dc:creator>
      <dc:date>2018-03-12T09:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy documents to a relevant folder</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63257#M21744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Simply get the name path until the "COMMISSION_MEETINGS" folder and then iterate over iters chidlren, checking the folder names against your pattern using endsWith / regex checks. Or you may perform an FTS query using the "search" root scope object looking into the path and doing a wildcard match on the folder names.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2018 12:41:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63257#M21744</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2018-03-12T12:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy documents to a relevant folder</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63258#M21745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Axel.&lt;BR /&gt;Could you please give me a sample code how to do it. I have no idea about how to change my code to achieve this.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2018 04:31:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63258#M21745</guid>
      <dc:creator>anuradha1</dc:creator>
      <dc:date>2018-03-13T04:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy documents to a relevant folder</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63259#M21746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How did you write the code you already have? It shouldn't need a sample to make two or three small adjustments to the code if you have written it yourself. I recommend you make yourself familiar with the &lt;A href="https://docs.alfresco.com/5.2/references/API-JS-ScriptNode.html" rel="nofollow noopener noreferrer"&gt;ScriptNode API&lt;/A&gt;&amp;nbsp;if you are unsure about which properties / functions to call. Specifically you should only need to use the childFileFolders() function and the name property to deal with the contents of the COMMISSION_MEETINGS folder and filter by name..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2018 17:12:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63259#M21746</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2018-03-13T17:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy documents to a relevant folder</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63260#M21747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;just change the way you filled your "today" variable&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2018 19:44:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63260#M21747</guid>
      <dc:creator>mehe</dc:creator>
      <dc:date>2018-03-13T19:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy documents to a relevant folder</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63261#M21748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'll try this way &amp;amp; will inform if i success in this.&lt;BR /&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2018 04:41:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63261#M21748</guid>
      <dc:creator>anuradha1</dc:creator>
      <dc:date>2018-03-14T04:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy documents to a relevant folder</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63262#M21749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have achieved that task using&amp;nbsp;childFileFolders() method.&lt;/P&gt;&lt;P&gt;Thanks all for helping me.&lt;/P&gt;&lt;P&gt;My JS code is below, in case if someone needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Get document created date&lt;BR /&gt;var createdDate = document.properties["cm:created"];&lt;/P&gt;&lt;P&gt;//Get date, month &amp;amp; year seperately from the createdDate&lt;BR /&gt;var dd = createdDate.getDate();&lt;BR /&gt;var mm = createdDate.getMonth()+1; //January is 0!&lt;BR /&gt;var yyyy = createdDate.getFullYear();&lt;/P&gt;&lt;P&gt;//Date &amp;amp; month formatting&lt;BR /&gt;if(dd&amp;lt;10){&lt;BR /&gt; dd='0'+dd;&lt;BR /&gt;} &lt;BR /&gt;if(mm&amp;lt;10){&lt;BR /&gt; mm='0'+mm;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;//Get access to the parent folder&lt;BR /&gt;var objDestFolder = companyhome.childByNamePath("Shared/public");&lt;/P&gt;&lt;P&gt;//Get all childrens in the parent folder into nodes array&lt;BR /&gt;var nodes = objDestFolder.childFileFolders();&lt;BR /&gt;var x = nodes.length;&lt;BR /&gt;nodes.sort(function(a, b){return a - b});&lt;/P&gt;&lt;P&gt;//Chack whether folder name(date) &amp;gt; created date&lt;BR /&gt;for (i = 0; i &amp;lt; x; i++) {&lt;BR /&gt; var ch = objDestFolder.children[i].name;&lt;BR /&gt; var ch1 = objDestFolder.children[i].properties["cm:title"];&lt;BR /&gt; var res = ch1.split(": ");&lt;BR /&gt; var fDate = res[1];&lt;BR /&gt; var res1 = fDate.split("/");&lt;BR /&gt; var fDD = res1[0];&lt;BR /&gt; var fMM = res1[1];&lt;BR /&gt; var fYYYY = res1[2];&lt;BR /&gt; if(yyyy == fYYYY)&lt;BR /&gt; {&lt;BR /&gt; if(mm == fMM) &lt;BR /&gt; {&lt;BR /&gt; if(dd &amp;lt;= fDD) &lt;BR /&gt; {&lt;BR /&gt; //Document move to the relevant folder&lt;BR /&gt; var folderDes = companyhome.childByNamePath("Shared/public/" + ch);&lt;BR /&gt; document.move(folderDes);&lt;BR /&gt; &lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2018 06:34:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/script-to-copy-documents-to-a-relevant-folder/m-p/63262#M21749</guid>
      <dc:creator>anuradha1</dc:creator>
      <dc:date>2018-03-19T06:34:14Z</dc:date>
    </item>
  </channel>
</rss>

