combine multiple files

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
sjj
Junior Member
Junior Member
Posts: 5
Joined: 2013-05-28, 14:25 UTC

combine multiple files

Post by *sjj »

I would like to combine more files at the same time, but TC can combine only one at a time.

For example:
There is
FileA.001
FileA.002
FileA.crc
FileB.001
FileB.002
FileB.crc
I would select FileA.001 and FileB.001 and click File>Combine and I would expect that FileA and FileB are combined from their splitted files.

How can I do that? Is there a script or add-in for this?
jjk
Member
Member
Posts: 181
Joined: 2003-07-03, 10:41 UTC

Post by *jjk »

See here :
http://ghisler.ch/board/viewtopic.php?t=23254
or
http://ghisler.ch/board/viewtopic.php?t=27690
There are many subjects about your wish.
Search "combine" or "merge" for example.
sjj
Junior Member
Junior Member
Posts: 5
Joined: 2013-05-28, 14:25 UTC

Post by *sjj »

I think neither of these answers my question. I have more hundred files to be combined. I can't do it one by one.

I also found the first link, but I think it can handle only 1 file at a time as I understood the script. I would be able to create a similar script, which process more files at the same time, but I would search for an easier or a Total Commander solution.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You can use this tool for quick appending data to a new or existing file. Just save as text and decode with TC.

Code: Select all

MIME-Version: 1.0
Content-Type: application/octet-stream; name="AppendFile.cab"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="AppendFile.cab"

TVNDRgAAAABJBAAAAAAAACwAAAAAAAAAAwEBAAEAAABNQgAASwAAAAEAAxUACAAAAAAAAAAAvUJp
ViAAQXBwZW5kRmlsZS5leGUAMv1mtfYDAAhbgICNABACgAAAIwBWJAAAD2DrvT3ddruCu1yUvKVf
r+aAhFb2VW0j0j5yD3P1zqh5IN23cXfpXX33SuxhGRbqxnyfULDYb2xBwAwMDyBjVxtqMyaEEYBF
6IQM6Q05GysAxAAAakQAzKoAfh822AqJVoAO6ACBQNwESSuOSiH2jQ4RMWl6cLAFtyPmRJuwwIii
2whA6QaiEv8+77/++yBoAAAAAAQACKr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YYozjmie9g8XH7g2djczjLW0vK6sP8vS7BuLKG1
hA5d6jQAFG2M//u+AM4=
Next you may write some batch that will accept %WL and convert it into a cycle of AppendFile calls, like this (batch should be placed together with the tool):

Code: Select all

@echo off
if -%2==- echo Parameters: %P%N.out %%WL & pause & goto :EOF
for /f "usebackq delims=" %%f in (`type %2`) do "%~dp0\AppendFile.exe" %1 "%%f"
Or you can use it w/o batch (with limited number of files because of command line length limit):

Code: Select all

Command=AppendFile.exe
Parameters=%P%N.out %P%S
Single-call method will work faster (don't know how much) because tool is launched only once and target file is opened only once too.

The only way you should think about carefully is how to ask/pass destination file path. However you can use my AskParam tool for asking destination file name path.
Last edited by MVV on 2013-05-29, 06:54 UTC, edited 1 time in total.
User avatar
EricB
Senior Member
Senior Member
Posts: 355
Joined: 2008-03-25, 22:21 UTC
Location: The Netherlands

Post by *EricB »

Hi,

Alternatively, Balderstrom wrote a batch file (see last page of this thread http://ghisler.ch/board/viewtopic.php?p=213997#213997) which lets you combine the text in all selected files, even using a separator of your own choice. This is assuming you want to combine text and not binary.

Regards, EricB
jjk
Member
Member
Posts: 181
Joined: 2003-07-03, 10:41 UTC

Post by *jjk »

Here http://ghisler.ch/board/viewtopic.php?t=17785 you can see an answer from Van Dusen to combine selected files to target pane.
Create a button with:

Code: Select all

Command   : %ComSpec% /c
Parameters: For /F %%f IN (%l) DO Type %%f >>%t\Combined.out
This will combine the selected files from the source panel to the file "Combined.out" in the target path.
I use it always and it matches my needs.
Of course it merges text files.

I have slightly modified it to insert the file name :

Code: Select all

Parameters : For /F %%f IN (%L) DO Echo /*______ Fichier %%f ______ */ >>%t\Combined.out&Type %%f >>%t\Combined.out
User avatar
nsp
Power Member
Power Member
Posts: 1803
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

sjj wrote:I think neither of these answers my question. I have more hundred files to be combined. I can't do it one by one.

I also found the first link, but I think it can handle only 1 file at a time as I understood the script. I would be able to create a similar script, which process more files at the same time, but I would search for an easier or a Total Commander solution.
Out of the box TC do not do this !
I've made a quick and dirty script that you can use with %S you only select crc or 001 file !
Assumptions :
- all file to merge are present !
- first file to merge start with 001 extension and last is before 999 !

you can adapt it as you wish...

Code: Select all

@echo off
:START
if "%1" EQU "" GOTO END
SET FileInput=%~n1
echo.|set /p=copy /B "%FileInput%.001" >__domerge.cmd
for /L %%a in (0,1,9) do for /L %%b in (0,1,9) do for /L %%c in (0,1,9) do (   
  if "%%a%%b%%c" GTR "001" (
     if exist "%FileInput%.%%a%%b%%c" echo.|set/p= + "%FileInput%.%%a%%b%%c" >>__domerge.cmd  
  ) 
)
echo.|set /p= "%FileInput%" >>__domerge.cmd
call __domerge.cmd
del __domerge.cmd
shift
GOTO START
:END
pause
sjj
Junior Member
Junior Member
Posts: 5
Joined: 2013-05-28, 14:25 UTC

Thank you

Post by *sjj »

Thank you for all of your answers, I can do my own script based on your ideas. I think I will collect the first files into a text file on which I run a loop through, which will do the append for all of them. I will have the time later for this.
Post Reply