notepad ++-需要在目录中合并大量文件
我的目录中有50到60个文件,需要定期将它们连接成一个文件。
我考虑过使用notepad ++,以为可能有一个插件会帮上忙,但一直找不到。
还有其他想法吗?
假设这些是文本文件(因为您使用的是notepad ++)并且您在Windows上,则可以创建一个简单的批处理脚本以将它们串联在一起。
例如,在包含所有文本文件的目录中,执行以下操作:
for %f in (*.txt) do type "%f" >> combined.txt
这会将所有与* .txt匹配的文件合并为一个名为Combined.txt的文件。
想要查询更多的信息:
[HTTP://呜呜呜.how to geek.com/how to/keyboard-ninja/keyboard-ninja-concatenate-multiple-text-files-in-Windows/]
使用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).**
因此,在您的情况下:
copy *.txt destination.txt
将所有.txt文件按字母顺序连接到destination.txt
感谢您的询问,我学到了一些新东西!
copy *.txt all.txt
这会将文件夹的所有文本文件连接到一个文本文件all.txt
如果您还有其他类型的文件,例如sql文件
copy *.sql all.sql
是的,有一个名为“ combine”的记事本++插件。链接:。>>组合记事本++插件
您可以通过插件管理器进行安装。 该插件的额外好处是:“您可以在合并时保持文件的顺序,这取决于打开的文件的顺序(请参见选项卡)”。
你可以这样使用powershell脚本
$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()
在Windows中,我在批处理文件中使用一个简单的命令,并且使用“计划任务”将所有信息保留在一个文件中。 请确保选择结果文件的其他路径,否则您将有重复的数据。
键入PathToOriginalFiles \ *。Extension> AnotherPathToResultFile \ NameOfTheResultFile.Extension
如果您需要加入大量的csv文件,则要做的一件好事是仅在一个文件头中添加标头,其名称应为0header.csv或其他名称,以便它始终是列表中的第一个文件,并且 确保将所有其他csv文件编程为不包含标头。
如果您想对Notepad ++上的打开文件执行此操作,则可以使用Combine插件:[http://www.scout-soft.com/combine/]
有一个方便的第三方工具FileMenu Tools,它提供了一些右键单击工具作为Windows资源管理器扩展。
其中之一是拆分文件/连接零件,它可以准确地执行和撤消您要查找的内容。
在[http://www.lopesoft.com/zh-CN/filemenutools]上进行检查。当然,它仅是Windows,因为Unixes环境已经有很多用于此的工具。
我知道这是一篇旧文章,但是我找到了,然后找到了一个建议使用Total Mail Converter的人。 我能够将包含2k .msg文件的文件夹转换为.txt。 它还允许您转换为PDF和其他流行格式。
这是一个很棒的工具,我很高兴有人提出建议,因为它可以节省我几天的时间。
仅供参考-我的项目是将.msg文件合并为一个文本文件,以便我可以运行脚本以从文件中提取某些信息(例如:电子邮件和链接)。 我可以处理一个而不是2k文件。
我在Windows Powershell上使用了此脚本:
ForEach ($f in get-ChildItem *.sql) { type "$f" >> all.sql }