Necesidad de combinar muchos archivos en un directorio
Tengo de 50 a 60 archivos en un directorio que necesito concatenar en un solo archivo de forma regular.
Pensé en usar notepad++ pensando que probablemente había un plug-in que ayudaría, pero no he sido capaz de encontrar uno.
¿Algún otro pensamiento?
10 answers
Asumiendo que estos son archivos de texto (ya que está usando notepad++) y que está en Windows, podría crear un simple script por lotes para concatenar juntos.
Por ejemplo, en el directorio con todos los archivos de texto, ejecute lo siguiente:
for %f in (*.txt) do type "%f" >> combined.txt
Esto fusionará todos los archivos que coincidan *.txt en un archivo llamado combinado.txt.
Para más información:
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-08-05 19:57:12
Utilice el comando 'copiar' de Windows.
C:\Users\dan>help copy
Copies one or more files to another location.
COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/L] [/A | /B ] source [/A | /B]
[+ source [/A | /B] [+ ...]] [destination [/A | /B]]
source Specifies the file or files to be copied.
/A Indicates an ASCII text file.
/B Indicates a binary file.
/D Allow the destination file to be created decrypted
destination Specifies the directory and/or filename for the new file(s).
/V Verifies that new files are written correctly.
/N Uses short filename, if available, when copying a file with
a non-8dot3 name.
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
/Z Copies networked files in restartable mode.
/L If the source is a symbolic link, copy the link to the
target
instead of the actual file the source link points to.
The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line. Default is
to prompt on overwrites unless COPY command is being executed from
within a batch script.
**To append files, specify a single file for destination, but
multiple files for source (using wildcards or file1+file2+file3
format).**
Así que en su caso:
copy *.txt destination.txt
Concatena todo .archivos txt en orden alfabético por destino.txt
Gracias por preguntar, aprendí algo nuevo!
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-03-23 17:13:03
copy *.txt all.txt
Esto concatena todos los archivos de texto de la carpeta en un solo archivo de texto.txt
Si tiene cualquier otro tipo de archivos, como archivos sql
copy *.sql all.sql
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-08-12 21:14:35
Sí , hay disponible un plugin llamado "combine" para notepad++.Enlace: .> > Combinar plugin para Notepad++
Puede instalarlo a través de plugin manager. Extra benifit de este plugin es: "Se puede mantener la secuencia de archivos durante la fusión, es de acuerdo con la secuencia de archivos abiertos se abren (ver pestañas)".
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-17 20:29:45
Podría usar el script de powershell de esta manera
$sb = new-object System.Text.StringBuilder
foreach ($file in Get-ChildItem -path 'C:\temp\xx\') {
$content = Get-Content -Path $file.fullname
$sb.Append($content)
}
Out-File -FilePath 'C:\temp\xx\c.txt' -InputObject $sb.toString()
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-08-05 20:04:13
En Windows uso un comando simple en un archivo por lotes y uso una Tarea Programada para mantener toda la información en un solo archivo. Asegúrese de elegir otra ruta al archivo de resultados, o tendrá datos duplicados.
Escriba PathToOriginalFiles\*.Prórroga > Otro pathtoresultfile\nameof Theesultfile.Extensión
Si necesita unir muchos archivos csv, una buena cosa es tener el encabezado en un solo archivo con un nombre como 0header.csv , u otro nombre, así que siempre será el primer archivo en la lista, y asegúrese de programar todos los demás archivos csv para que no contengan un encabezado.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-12-10 11:55:38
Si desea hacer esto para archivos abiertos en Notepad++, puede usar el complemento Combinar: http://www.scout-soft.com/combine /
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-09 12:49:48
Hay una herramienta de terceros conveniente llamada FileMenu Tools, que da varias herramientas de clic derecho como una extensión del explorador de Windows.
Uno de ellos es Archivo dividido / Join Parts, que hace y deshace exactamente lo que está buscando.
Compruébalo en http://www.lopesoft.com/en/filemenutools . Por supuesto, es solo Windows, ya que los entornos Unixes ya tienen muchas herramientas para eso.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-05-01 02:32:50
Sé que este es un post antiguo, pero lo encontré y luego encontré a alguien que sugirió Total Mail Converter. Pude convertir mi carpeta con 2k .msg archivos en .txt. También le permite convertir a PDF y otros formatos populares.
Es una gran herramienta que me alegro de que alguien sugirió, ya que me ahorrará varios días.
FYI - Mi proyecto está combinando el .msg archivos en un archivo de texto para que pueda ejecutar un script para extraer cierta información de los archivos (es decir: correo electrónico y vínculos). En lugar de archivos 2k, puedo trabajar con uno.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-11-19 16:56:34
Usé este script en Windows powershell:
ForEach ($f in get-ChildItem *.sql) { type "$f" >> all.sql }
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-04 02:50:47