by Mofi » Sat Feb 18, 2006 4:05 pm
Pantichd has not done it with UltraEdit. He has used old DOS command COPY from a Windows DOS shell.
Click on Windows Start button, select Run from the menu and enter cmd (for Windows NT/2000/XP) or command (for Win98/ME) and press OK. A DOS shell will open.
Goto the directory where you have the files to which contents should be merged to a single file. For example if they are at E:\Data Files enter following in the DOS shell (press ENTER for each line):
E:
cd "E:\Data Files"
Now enter following to get help about the good old copy command:
copy /?
This should give you enough information on how to use the copy command to merge the contents of a few files to one file. Two examples - an easy and a hard one:
copy *.txt Allfiles.txt
Copies all files with the extension *.txt in the current directory to the file Allfiles.txt in the current directory.
copy "File 1.txt"+Testx\File2.txt+"Other File.ini"+C:\Windows\Temp\Test.dat" "F:\Temp Files\MergeFiles.txt"
Copies File 1.txt in the current directory (contains a space in the filename so surrounding double quotes are needed) and File2.txt in the subdirectory Testx of the current directory and file Other File.ini in the current directory and the file Test.dat in the directory C:\Windows\Temp to the file MergeFiles.txt in the directory F:\Temp Files.
To close the DOS shell window when you are finished enter exit.
Of course you can run the DOS command also from within UltraEdit using Advanced - DOS Command.
Is this too complicated for you? Then use this macro to merge the content of all open files to a new file:
Clipboard 9
ClearClipboard
Loop
IfNameIs ""
ExitLoop
EndIf
Bottom
IfColNum 1
Else
"
"
EndIf
SelectAll
CopyAppend
CloseFile NoSave
EndLoop
NewFile
Paste
Top
ClearClipboard
Clipboard 0
How this macro works:
If the name of the current file does not exist (no file open anymore or the current edit window is just a file buffer which content is not saved to file), exit the content collecting loop.
If the current file has a name, goto the end of the file and check if the last line is terminated with a line ending. If the last line of the file has no line ending, insert one to make sure that last line of a file is not merged with the first line of the next file in one line. Then select everything of the file and append it to current content of user clipboard 9. Then close the current file without saving it.
After the loop has finished (normally no document is open anymore), create a new file and paste the clipboard content. Goto top of the new file, clear content of user clipboard 9 and switch back to windows clipboard.
The window history order (Window - Next Window) defines the order how the contents are merged and not the file tab order (Window - Next File Tab)!