<?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: pulling information with date condition: put filename into list if it is greater than a specified date and time in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/pulling-information-with-date-condition-put-filename-into-list/m-p/585197#M79087</link>
    <description>&lt;P&gt;You could try this....it should speed it up&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
path2 = "C:\Users\test\";
filelist = Files In Directory( path2 );
For( i = N Items( filelist ), i &amp;gt;= 1, i--,
	If( Right( filelist[i], 4 ) != ".zip",
		Remove From( filelist, i, 1 )
	)
);
lst2 = {};
For( i = 1, i &amp;lt;= N Items( filelist ), i++,
	If( Creation Date( path2 || filelist[i] ) &amp;gt; informat("2022-10-12T08:00:00", "yyyy-mm-ddThh:mm:ss"),
		Insert Into( lst2, filelist[i] )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 24 Dec 2022 22:10:11 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2022-12-24T22:10:11Z</dc:date>
    <item>
      <title>pulling information with date condition: put filename into list if it is greater than a specified date and time</title>
      <link>https://community.jmp.com/t5/Discussions/pulling-information-with-date-condition-put-filename-into-list/m-p/585140#M79081</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I m trying to&amp;nbsp; get the list of files name in a directory with given condition if it is 1) zip archive and also the 2) creation date greater than yyyy/mm/dd. Below is my script. My question&lt;/P&gt;&lt;P&gt;1) it ran without error but not return empty list. I 'm not sure what is the issue (perhaps the date).&lt;BR /&gt;2) how can I set the creation date () output format to yyyy/mm/dd hh:mm:ss?&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) it take long time to loop through the path2 because I have over 100K zip folders. Is there other faster way to do it?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;path2 = "C:\Users\test\;
filelist = files in directory (path2);
lst2 = {};
For(i=1, i&amp;lt;= N items(filelist), i++,
If( Contains(filelist[i], ".zip") &amp;amp; Creation Date( path2||filelist[i]) &amp;gt; 2022-10-12T08:00:00, Insert Into( lst2, filelist[i] )
),
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:05:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/pulling-information-with-date-condition-put-filename-into-list/m-p/585140#M79081</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2023-06-09T16:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: pulling information with date condition: put filename into list if it is greater than a specified date and time</title>
      <link>https://community.jmp.com/t5/Discussions/pulling-information-with-date-condition-put-filename-into-list/m-p/585161#M79082</link>
      <description>&lt;P&gt;In the example you provided, there is a missing double quote on the path2 =&amp;nbsp; &amp;nbsp; line, and also, the time reference does not seem to be handling by JMP, so by changing it to an Informat() function, one can be insured that the JMP Date/Time reference is being interpreted correctly.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
path2 = "C:\Users\test\";
filelist = Files In Directory( path2 );
lst2 = {};
For( i = 1, i &amp;lt;= N Items( filelist ), i++,
	If( Contains( filelist[i], ".zip" ) &amp;amp; Creation Date( path2 || filelist[i] ) &amp;gt; informat("2022-10-12T08:00:00", "yyyy-mm-ddThh:mm:ss"),
		Insert Into( lst2, filelist[i] )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Dec 2022 04:31:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/pulling-information-with-date-condition-put-filename-into-list/m-p/585161#M79082</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-12-24T04:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: pulling information with date condition: put filename into list if it is greater than a specified date and time</title>
      <link>https://community.jmp.com/t5/Discussions/pulling-information-with-date-condition-put-filename-into-list/m-p/585196#M79086</link>
      <description>&lt;P&gt;Hi Jim, Thanks. that fixed the problem. However, it take too much time when a folder has too many files to go through. Below are the new steps I have so next time when I just want to pull the latest files, it don't take the long time like using the date/time as filter (above). I 'm not sure if it is an effective way to do it. Is there any better way to just extract latest files with shorter time?&lt;/P&gt;&lt;P&gt;1) the first time get the whole filelist in the defined folder (&lt;SPAN&gt;Files In Directory(dir)&lt;/SPAN&gt;). Saved it into a column of a table, "T1" (only run one time)&lt;/P&gt;&lt;P&gt;2) after sometime, latest files added to the same folder. script will go to the same folder and take the whole filelist as "newlist" (newlist =&amp;nbsp;&lt;SPAN&gt;Files In Directory(dir))&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;3) get column in table 1) as list, then loop through to remove the elements out from newlist (I use Remove From ()) .&lt;/P&gt;&lt;P&gt;4) do whatever needed on newlist.&lt;/P&gt;&lt;P&gt;5) append newlist into table in 1).&lt;/P&gt;&lt;P&gt;6) repeat step 2)-5) next time when I need to get latest files again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestion?&lt;/P&gt;</description>
      <pubDate>Sat, 24 Dec 2022 21:53:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/pulling-information-with-date-condition-put-filename-into-list/m-p/585196#M79086</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2022-12-24T21:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: pulling information with date condition: put filename into list if it is greater than a specified date and time</title>
      <link>https://community.jmp.com/t5/Discussions/pulling-information-with-date-condition-put-filename-into-list/m-p/585197#M79087</link>
      <description>&lt;P&gt;You could try this....it should speed it up&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
path2 = "C:\Users\test\";
filelist = Files In Directory( path2 );
For( i = N Items( filelist ), i &amp;gt;= 1, i--,
	If( Right( filelist[i], 4 ) != ".zip",
		Remove From( filelist, i, 1 )
	)
);
lst2 = {};
For( i = 1, i &amp;lt;= N Items( filelist ), i++,
	If( Creation Date( path2 || filelist[i] ) &amp;gt; informat("2022-10-12T08:00:00", "yyyy-mm-ddThh:mm:ss"),
		Insert Into( lst2, filelist[i] )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Dec 2022 22:10:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/pulling-information-with-date-condition-put-filename-into-list/m-p/585197#M79087</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-12-24T22:10:11Z</dc:date>
    </item>
  </channel>
</rss>

