有没有简单的方法可以做到这一点?我实际上使用 合并了大约 500 个文件copy *.txt myoutputFile.txt
。问题是,该命令将新/下一个文件插入到文件的当前/结束位置,而我需要将其插入到新行中。
答案1
for f in *.txt
do
echo -e -n '\n' >> "$f"
done
答案2
我决定快速编写一个 VBScript:
Dim fso, folder, files
Dim strPath
Const ForAppending = 8
' Create a FileSystemObject
Set fso = CreateObject("Scripting.FileSystemObject")
' Define folder we want to list files from
strPath = "C:\members"
Set folder = fso.GetFolder(strPath)
Set files = folder.Files
' Loop through each file
For each item In files
set textFile = FSO.OpenTextFile(item, ForAppending)
textFile.WriteLine()
textFile.Close()
Next