Plugin to merge/combine files?
Moderators: Hacker, petermad, Stefan2, white
Plugin to merge/combine files?
I have to merge/combine text-files very often. Is there a (packer?)-plugin to select files and then concatenate them?
Peter
Peter
TC 10.xx / #266191
Win 10 x64
Win 10 x64
You can do that already if you rename your files first using [C] and then use Files, Combine files it will automatically merge 1.txt and all ascending filenames (2.txt 3.txt 4.txt etc) to one file.
Edit: If the order doesn't matter at all and you want to merge all *.txt files in the current dir you can use a batch file or type in the command bar: copy *.txt /b > mergedfile
Edit: If the order doesn't matter at all and you want to merge all *.txt files in the current dir you can use a batch file or type in the command bar: copy *.txt /b > mergedfile
You can use RegXtract for this.
Just use the default values (.* and $0) an enable Search and Replace.
You could also enable dotall to speed up things a little.
Now set the outfile extension accordingly and the files get merged in the order of input,
which is the current Total Commander sort settings for the active pane (by name, date, ...custom columns...).
Just use the default values (.* and $0) an enable Search and Replace.
You could also enable dotall to speed up things a little.
Now set the outfile extension accordingly and the files get merged in the order of input,
which is the current Total Commander sort settings for the active pane (by name, date, ...custom columns...).
Peter,
It should suffice to add a new extension, .001, .002, etc., so the Extension field in the MRT would look like this:
Then select the first file and choose Combine Files from the Files menu.
HTH
Roman
It should suffice to add a new extension, .001, .002, etc., so the Extension field in the MRT would look like this:
Code: Select all
[E].[C:3]
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: Plugin to merge/combine files?
Just with plain PowerShellPeter wrote:I have to merge/combine text-files very often. Is there a (packer?)-plugin to select files and then concatenate them?
Peter
Code: Select all
TOTALCMD#BAR#DATA
powershell
-command $out=""""""; foreach($file in dir *.txt){$out += """Content of $file`r`n`r`n""" + [System.IO.File]::ReadAllText($file, [System.Text.Encoding]::Default ) + """`r`n`r`n##### EOF #####`r`n`r`n"""}; $out | out-file _outfile.txt
%Commander_Path%\WCMICONS.DLL,6
PowerShell Merge TXT files to _outfile.txt
-1
This will result in something like:
- - -_outfile.txt wrote: Content of D:\rive\path\abc.txt
abc
abc
abc
##### EOF #####
Content of D:\rive\path\opq.txt
opq
opq
opq
##### EOF #####
Content of D:\rive\path\xyz.txt
xyz
xyz
xyz
##### EOF #####
Note:
we can shorten that command to
-command $o=""""""; foreach($f in dir *.txt){$o += """Content of $f`r`n`r`n""" + [IO.File]::ReadAllText($f, [Text.Encoding]::Default ) + """`r`n`r`n##### EOF #####`r`n`r`n"""}; $o | out-file _outfile.txt
and you can drop ", [Text.Encoding]::Default " if you work with plain ASCII 7-bit only.
- - -
Note:
for use with TC I had to escape the quote chars: " > """
If I had used the un-escaped quotes like
Code: Select all
TOTALCMD#BAR#DATA
powershell -NoExit
-command $out=""; foreach($file in dir *.txt){$out += "Content of $file`r`n`r`n" + [System.IO.File]::ReadAllText($file, [System.Text.Encoding]::Default ) + "`r`n`r`n##### EOF #####`r`n`r`n"}; $out | out-file _outfile.txt
%Commander_Path%\WCMICONS.DLL,6
PowerShell Merge TXT files to _out.txt
-1
Code: Select all
Sie müssen auf der rechten Seite des Operators "=" einen Wertausdruck angeben.
Bei Zeile:1 Zeichen:6
+ $out= <<<< ; foreach($file in dir *.txt){$out += Content of $file`r`n`r`n + [Syst
m.Text.Encoding]::Default ) + `r`n`r`n##### EOF #####`r`n`r`n}; $out | out-file _ou
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordExcepti
+ FullyQualifiedErrorId : ExpectedValueExpression
I wish TC had an -RAW parameter.
For reference: http://www.ghisler.ch/board/viewtopic.php?t=28063 (using TCBL or a simple batch script) If you happen to be a AutoHotkey user you can use that too. TCBL can be found here http://www.ghisler.ch/board/viewtopic.php?t=9374
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)