Sign in to follow this  
Followers 0
MartinB

Combine Several files into one File

9 posts in this topic

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 :">

Share this post


Link to post
Share on other sites



Why not just automate the DOS command? No need to re-invent the wheel :P

Share this post


Link to post
Share on other sites

Why not just automate the DOS command? No need to re-invent the wheel :P

How or what do you mean? Some of this is new to me so any help would be greatly received.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
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)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0