MartinB Posted January 6, 2006 Share Posted January 6, 2006 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 More sharing options...
trids Posted January 6, 2006 Share Posted January 6, 2006 Why not just automate the DOS command? No need to re-invent the wheel Link to comment Share on other sites More sharing options...
MartinB Posted January 6, 2006 Author Share Posted January 6, 2006 Why not just automate the DOS command? No need to re-invent the wheel How or what do you mean? Some of this is new to me so any help would be greatly received. Link to comment Share on other sites More sharing options...
trids Posted January 6, 2006 Share Posted January 6, 2006 (edited) Sorry .. 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 January 6, 2006 by trids Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted January 6, 2006 Moderators Share Posted January 6, 2006 (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 January 6, 2006 by big_daddy Link to comment Share on other sites More sharing options...
MartinB Posted January 6, 2006 Author Share Posted January 6, 2006 Sorry .. 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 More sharing options...
trids Posted January 6, 2006 Share Posted January 6, 2006 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 More sharing options...
MartinB Posted January 6, 2006 Author Share Posted January 6, 2006 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 More sharing options...
trids Posted January 6, 2006 Share Posted January 6, 2006 (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 January 6, 2006 by trids Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now