Tengo> 600,000 tablas de datos jmp en una sola carpeta y cada una de ellas tiene 12,000 filas y el tamaño del archivo de cada una es de ~ 100kb. He intentado sin éxito resolver todos estos problemas pero, como era de esperar, solo puedo generar un archivo de ~ 15 millones de filas (aproximadamente 1200 archivos) antes de que JMP se quede sin vapor y no responda.
Utilicé este script para realizar la operación, que copié de una de estas discusiones (disculpas, pero no pude encontrar el tablero real, así que no puedo vincularlo). Podría copiar 1.000 archivos en carpetas individuales y luego concat, pero eso sería bastante tedioso.
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" );
Este complemento tampoco funciona https://community.jmp.com/t5/JMP-Add-Ins/Bulk-Concatenate-Add-in/ta-p/35435
¿Hay una manera de concatenar solo los primeros 1000 archivos, guardar la tabla concatenada, cerrarla y luego pasar al siguiente conjunto de 1,000? He intentado algunas cosas, pero por lo general solo se detienen después de completar el primer set.
Saludos
David
Aquí hay una modificación a su script actual que ahora guarda cada 1000 archivos en un archivo concatenado. En la nueva secuencia de comandos, también corregí un error, donde algunas veces no estaba concatenando correctamente "mypath" con la cadena "_Concatenated Files". Además, en su declaración de Guardar, estaba apuntando a la tabla de datos incorrecta para guardar.
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 ));