Jump to content

Combine Several files into one File


Recommended Posts

Hi,

I what to copy several files into one single file. In MS-DOS I would use Copy file*.dat = new.dat

Eg.

3 files starting with paybacs*.dat combine into one file call Opay.dat.

I have try FileCopy not all 3 thress are in the new file created.

Can someone help.

thanks :">

Link to comment
Share on other sites

Sorry :P .. something like this untested code:

;au3 script code
    $sPath = "C:\Some Place\"
    Run ('@COMSPEC /c COPY "' & $sPath & 'paybacs*.dat" Opay.dat', "", @SW_HIDE)

edit: debugged the code

Edited by trids
Link to comment
Share on other sites

  • Moderators

What if the files being copied are not in the same place as the destination file?

This should allow for that:

;Don't forget the trailing \
$Path1 = "C:\Path to files being copied\"
$Path2 = "C:\Path to file being copied to\"
RunWait(@Comspec & " /c copy " & $Path1 & "paybacs*.dat" & " " & $Path2 & "Opay.dat", @TempDir, @SW_HIDE)

edit: forgot a space after copy

Edited by big_daddy
Link to comment
Share on other sites

Sorry :P .. something like this untested code:

;au3 script code
    $sPath = "C:\Some Place\"
    Run ('@COMSPEC /c COPY "' & $sPath & 'paybacs*.dat" Opay.dat', "", @SW_HIDE)

edit: debugged the code

I have tried you example and get an errror unable to find files.

i have attached the au3 script code, so you can see what i am trying to do.

BACSConvert2.au3

Link to comment
Share on other sites

Around line 85, try replacing your..

Run ('@COMSPEC /X COPY "' & $sPath1 & '$sPath2', "", @SW_HIDE)
with this..
Run ('@COMSPEC /X COPY "' & $sPath1 & '" "' & $sPath2 & '"', "", @SW_HIDE)

Link to comment
Share on other sites

Around line 85, try replacing your..

Run ('@COMSPEC /X COPY "' & $sPath1 & '$sPath2', "", @SW_HIDE)
with this..
Run ('@COMSPEC /X COPY "' & $sPath1 & '" "' & $sPath2 & '"', "", @SW_HIDE)

i have replaced the line and the error is on this line and states:

Error: Unable to execute the external program.

The system cannot find the file specified.

Link to comment
Share on other sites

Not sure what "/X" does .. i usually use "/C" after @COMSPEC.

Try copying the line you want to execute to the clipboard and then paste the results to a DOS session and run it there..

;Run ('@COMSPEC /C COPY "' & $sPath1 & '" "' & $sPath2 & '"', "", @SW_HIDE)
$sDOS  = @COMSPEC & ' /C COPY "' & $sPath1 & '" "' & $sPath2 & '"'
ClipPut($sDOS)
Run ($sDOS, "", @SW_HIDE)

edit: eureka (i think?)

Edited by trids
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...