Jump to content

Merge Files


AcidCorps
 Share

Recommended Posts

I'm looking for a way to copy multiple files into one (not an archive) like you can do through CMD using the following command:

Copy /b File.ext File2.ext Comb.ext

I tried using FileCopy('File.ext' + File2.ext', 'Comb.ext')

I tried FileRead then combining the strings then writing a new file

neither of these worked

what I'm using to test it is a 7z SFX where you combine the archive with a config file and the SFX file:

copy /b 7zs.sfx + config.txt + Archive.7z Installer.exe

but with the two attempts i've made through autoit I get an unusable EXE

I'd like to be able to do this without using @ComSpec or CMD if possible since but if I need to I can do it that way I was just hoping someone else would have another way

- Acid Corps

Link to comment
Share on other sites

I tried FileRead then combining the strings then writing a new file

Make sure you're opening the files in binary mode.

Func _FileMerge($s_SrcFile1, $s_SrcFile2, $s_DestFile)
    ; Read Files in Binary Mode
    Local $h_File1 = FileOpen($s_SrcFile1 , 16)
    Local $h_File2 = FileOpen($s_SrcFile2 , 16)
    FileWrite($s_DestFile, FileRead($h_File1) & FileRead($h_File2))
EndFunc

Tested with split.exe. (http://unxutils.sourceforge.net/)

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...