User Tools

Site Tools


gams:dynamic_renaming_of_put-files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

gams:dynamic_renaming_of_put-files [2007/08/09 14:25] (current)
Line 1: Line 1:
 +====== Dynamic renaming of put-files ======
 +<​code>​
 +$title example for renaming put files
 +file test / test.txt /;
 +put test;
 +set i / i01*i10 /;
  
 +loop(i,
 +* this will flush and close the current put file and rename it
 +* to any name written in the second line of the put statement
 +   ​put_utilities '​ren'​ / '​test.':​0 i.tl:​0 ​ ;
 +   put 'this should be ' i.tl
 +  );
 +
 +</​code>​
 +
 +Using another put_utility this also works with directory names. Below is an extended version of the example, which generates the subdirectory during the loop as well.
 +<​code>​
 +file test / test.txt /;
 +put test;
 +set i / i01*i10 /;
 +
 +loop(i,
 +* generate the directories
 +     ​put_utilities '​exec'​ / 'mkdir ' '​test-':​0 i.tl:0;
 +
 +* this will flush and close the current put file and rename it
 +* to any name written in the second line of the put statement
 +     ​put_utilities '​ren'​ / '​test-':​0 i.tl:0 '/​test-':​0 i.tl:0 '​.txt':​0 ;
 +     put 'this should be ' i.tl
 +   );
 +</​code>​
IMPRESSUM / LEGAL NOTICEPRIVACY POLICY gams/dynamic_renaming_of_put-files.txt ยท Last modified: 2007/08/09 14:25 (external edit)