フォルダーを開いてファイルをスキャンし、異なるファイルで異なる機能を実行しようとしています。私はこれをこれまで行ってきましたが、関数に到達すると、ファイルは無限ループに入りますが、1つのprintステートメントがある場合はこれを行いません。無限ループに入る関数の部分は、ディレクトリを選択してファイルを開く手間をかけずに単独で使用するとうまく機能します。無限ループが単独で機能した場合、無限ループの原因を指摘してください。
myfunc = function({dt,mypath},{Dedault Local},
col_list = dt << get column names( string );
new_list = {};
For( i = N Items( col_list ), i > 0, i--, //For loop to create an array of the different column strings
If( Regex( col_list[i], "<SOME regex="">") == col_list[i],
Insert Into( new_list, col_list[i] ), //Insert Into(new_list,col_list[i]),
Remove From( col_list, i ); //If the string is not what we are looking for remove it from the array
)
);
Return(new_list);
);
mypath = Pick Directory ( "Select a directory." );
files = Files In Directory(mypath);
MY_FILES = files;
FOR(i=1, i <= N items(files), i++,
if(Ends with(files[i],"_myfile.csv"),
dt = Open(mypath || files[i]);
dname = dt << Get Name;
If(
Contains( dname, "_myfile" ) > 0, myfunc(dt,mypath),
"File is wrong"
); ,
));
</SOME>