文件夾中定義數量的.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 ));