[ExM Users] create directory based on loop index

Ketan Maheshwari ketan at mcs.anl.gov
Wed Jul 30 10:34:03 CDT 2014


Thanks, create-dir has worked. I think I need a bit more than this: Is it
possible to cd into this newly created dir and run the app. This is needed
because the Rosetta invocation does not have a way to distinguish some of
the outputs and will result in overwrites. The code is as follows:

foreach pdb in PDB{
    foreach i in [0:9]{
    create_dir("dir"+fromint(i)) => leaf_main(["-database", "...", "..."]);
//need to perform this operation inside diri
  }
 }

Thanks,
Ketan


On Wed, Jul 30, 2014 at 10:04 AM, Tim Armstrong <tim.g.armstrong at gmail.com>
wrote:

>  You'll also need to convert the loop index to a string with fromint(i)
> or sprintf("%i", i) or similar.
>
>  It's probably better and less error-prone in general to ensure that any
> functions that create their output files also create the directory.  App
> functions should already do this (if they don't, it's a bug).
>
>   - Tim
>
>
> On Wed, Jul 30, 2014 at 9:52 AM, Justin M Wozniak <wozniak at mcs.anl.gov>
> wrote:
>
>>
>> Yes but do it like this:
>>
>> foreach i in [0:99]{
>>      create_dir("dir"+i) =>
>>        do_some_op(inargs, "dir"+i+"/"+outfile);
>> }
>>
>>
>>
>>  On 07/30/2014 09:50 AM, Ketan Maheshwari wrote:
>>
>>  In T, is it possible to create directory on the fly within a foreach
>> loop like so:
>>
>>  foreach i in [0:99]{
>>     create_dir("dir"+i);
>>     do_some_op(inargs, "dir"+i+"/"+outfile);
>> }
>>
>>  Thanks,
>> Ketan
>>
>>
>>  _______________________________________________
>> ExM-user mailing listExM-user at lists.mcs.anl.govhttps://lists.mcs.anl.gov/mailman/listinfo/exm-user
>>
>>
>>
>> --
>> Justin M Wozniak
>>
>>
>> _______________________________________________
>> ExM-user mailing list
>> ExM-user at lists.mcs.anl.gov
>> https://lists.mcs.anl.gov/mailman/listinfo/exm-user
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/exm-user/attachments/20140730/9a4692eb/attachment.html>


More information about the ExM-user mailing list