文件夹中定义数量的.jmp文件的连接我在一个文件夹中有> 600,000个jmp数据表,每个数据表有12,000行,每个文件大小约为100kb。我试图将所有这些结合在一起但没有成功,但不出所料,我只能生成一个约1500万行(大约1200个文件)的文件,然后JMP耗尽并且没有响应。
我使用这个脚本来执行操作,我从其中一个讨论中复制了这些操作(道歉,但我找不到实际的板,因此无法链接到它)。我可以将1,000个文件复制到单个文件夹然后连续但这将是相当繁琐的。
mypath = Pick Directory( "Select a directory" );
Set Current Directory( mypath );
y = Files In Directory( mypath );
For( i = N Items( y ), i > 0, i--,
If( Ends With( y[i], "jmp" ),
,
Remove From( y, i )
)
);
n = N Items( y );
For( i = 1, i <= N Items( y ), i++,
sname = Left( y[i], Length( y[i] ) - 4 );
/* If the file is the first in the list, open it. Otherwise, open the table, concatenate with the main table, and close the table just opened. */
If( i == 1,
mainDt = Open( mypath || y[i] );
mainDt << New Column( "source", character, set each value( sname ) );
,
dt = Open( mypath || y[i], hidden, invisible );
dt << New Column( "source", character, set each value( sname ) );
mainDt = mainDt << Concatenate( dt, Append to First Table );
Close( dt, NoSave );
Wait( 0 );
);
);
/* Give the final table a name. */
mainDt << Set Name( mypath, "_Concatenated Files" );
dt << Save( mypath, "_Concatenated Files" );
此加载项也不起作用 https://community.jmp.com/t5/JMP-Add-Ins/Bulk-Concatenate-Add-in/ta-p/35435
有没有办法只连接前1000个文件,保存连接表,关闭它然后移动到下一组1000?我尝试了一些东西,但它们通常在第一组完成后停止。
问候
大卫
Re:连接文件夹中定义数量的.jmp文件以下是对当前脚本的修改,现在将每1000个文件保存到一个连接文件中。 在新脚本中,我还更正了一个错误,其中有几次你没有正确地将“mypath”与“_Concatenated Files”字符串连接起来。 此外,在Save语句中,您指向要保存的错误数据表。
mypath = Pick Directory( "Select a directory" );
Set Current Directory( mypath );
y = Files In Directory( mypath );
For( i = N Items( y ), i > 0, i--,
If( Ends With( y[i], "jmp" ),
,
Remove From( y, i )
)
);
n = N Items( y );
counter=0;
For( i = 1, i <= N Items( y ), i++,
sname = Left( y[i], Length( y[i] ) - 4 );
/* If the file is the first in the list, open it. Otherwise, open the table, concatenate with the main table, and close the table just opened. */
If( counter == 0,
mainDt = Open( mypath || y[i] );
mainDt << New Column( "source", character, set each value( sname ) );
,
dt = Open( mypath || y[i], hidden, invisible );
dt << New Column( "source", character, set each value( sname ) );
mainDt = mainDt << Concatenate( dt, Append to First Table );
Close( dt, NoSave );
Wait( 0 );
);
counter = counter + 1;
If(mod(counter,1000) == 0,
mainDt << Set Name( mypath || "_Concatenated_Files_" || char(i) || "_" || char(i+counter) );
mainDt << Save( mypath || "_Concatenated_Files_" || char(i) || "_" || char(i+counter) );
counter = 0;
)
);
/* Give the final table a name. */
mainDt << Set Name( mypath || "_Concatenated_Files_" || char(i) || "_" || char(i+counter) );
mainDt << Save( mypath || "_Concatenated_Files_" || Char( i ) || "_" || Char( i + counter ));