<?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 How to perform File Functions on multiple files. Looks like I can't use wildcards? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-perform-File-Functions-on-multiple-files-Looks-like-I-can/m-p/214164#M42821</link>
    <description>&lt;P&gt;How do I perform File Functions on multiple files using wildcards? Let's say after finished with files I'd like to sort them into corresponding folders like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Move Files("c:/temp/*.jmp", "c:/temp/processed_jmp/");

Move Files("c:/temp/*.csv", "c:/temp/processed_csv/");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Looks like this won't work with wildecards. I'd hate to go into getting list of all files, break it into separate lists for each extension, then making FOR loops to iterate through each file.... Is there a more elegant way of doing that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jun 2019 21:29:06 GMT</pubDate>
    <dc:creator>miguello</dc:creator>
    <dc:date>2019-06-21T21:29:06Z</dc:date>
    <item>
      <title>How to perform File Functions on multiple files. Looks like I can't use wildcards?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-perform-File-Functions-on-multiple-files-Looks-like-I-can/m-p/214164#M42821</link>
      <description>&lt;P&gt;How do I perform File Functions on multiple files using wildcards? Let's say after finished with files I'd like to sort them into corresponding folders like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Move Files("c:/temp/*.jmp", "c:/temp/processed_jmp/");

Move Files("c:/temp/*.csv", "c:/temp/processed_csv/");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Looks like this won't work with wildecards. I'd hate to go into getting list of all files, break it into separate lists for each extension, then making FOR loops to iterate through each file.... Is there a more elegant way of doing that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 21:29:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-perform-File-Functions-on-multiple-files-Looks-like-I-can/m-p/214164#M42821</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2019-06-21T21:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform File Functions on multiple files. Looks like I can't use wildcards?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-perform-File-Functions-on-multiple-files-Looks-like-I-can/m-p/214175#M42822</link>
      <description>&lt;P&gt;Right now I have it implemented this way:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;path = "c:/temp/";
pathProcessed = path||"processed/";
listOfFiles = Files In Directory(path);

for(i=1, i&amp;lt;=N Items(listOfFiles), i++, 
if(Contains(listOfFiles[i], ".jmp")&amp;gt;0, Move File(path||listOfFiles[i], pathProcessed||listOfFiles[i]));	
	
	
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it looks awkward...&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 21:58:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-perform-File-Functions-on-multiple-files-Looks-like-I-can/m-p/214175#M42822</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2019-06-21T21:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform File Functions on multiple files. Looks like I can't use wildcards?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-perform-File-Functions-on-multiple-files-Looks-like-I-can/m-p/214183#M42827</link>
      <description>&lt;P&gt;You could use RunProgram, something like this (lots of setup for a complete example)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Delete Directory( "$temp/aaa" ); // make sure source is empty
Create Directory( "$temp/aaa" );

Save Text File( "$temp/aaa/a1.txt", "a" );
Save Text File( "$temp/aaa/a2.txt", "aa" );
Save Text File( "$temp/aaa/a3.bad", "no suffix" );

Delete Directory( "$temp/bbb" ); // make sure dest is empty
Create Directory( "$temp/bbb" );

aaa = Convert File Path( "$temp/aaa", "windows" ); // "C:\Users\v1\AppData\Local\Temp\aaa"
bbb = Convert File Path( "$temp/bbb", "windows" ); // "C:\Users\v1\AppData\Local\Temp\bbb"

aaawild = aaa || "\a*.txt"; // wild card *

result = Run Program( Executable( "CMD.EXE" ),
 Options( {"/a", "/q", "/c move ", aaawild, bbb} ), ReadFunction( "text" ) );

Write( result );

Show( Files In Directory( aaa ) );
Show( Files In Directory( bbb ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;C:\Users\v1\AppData\Local\Temp\aaa\a1.txt&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;C:\Users\v1\AppData\Local\Temp\aaa\a2.txt&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;2 file(s) moved.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Files In Directory(aaa) = {"a3.bad"};&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Files In Directory(bbb) = {"a1.txt", "a2.txt"};&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/a and /q are &lt;A href="https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd" target="_blank" rel="noopener"&gt;options&lt;/A&gt; for CMD.EXE, and /c passes the move command to CMD.EXE.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jun 2019 12:22:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-perform-File-Functions-on-multiple-files-Looks-like-I-can/m-p/214183#M42827</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2019-06-22T12:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform File Functions on multiple files. Looks like I can't use wildcards?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-perform-File-Functions-on-multiple-files-Looks-like-I-can/m-p/214645#M42925</link>
      <description>Yeah, I wouldn't call this more elegant. I've seen this solution, yes, but I'd rather stick to my current solution.&lt;BR /&gt;Thanks a lot!</description>
      <pubDate>Tue, 25 Jun 2019 22:36:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-perform-File-Functions-on-multiple-files-Looks-like-I-can/m-p/214645#M42925</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2019-06-25T22:36:52Z</dc:date>
    </item>
  </channel>
</rss>

