MartinB Posted January 6, 2006 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 :">
trids Posted January 6, 2006 Posted January 6, 2006 Why not just automate the DOS command? No need to re-invent the wheel
MartinB Posted January 6, 2006 Author 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.
trids Posted January 6, 2006 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
Moderators big_daddy Posted January 6, 2006 Moderators 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
MartinB Posted January 6, 2006 Author 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
trids Posted January 6, 2006 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)
MartinB Posted January 6, 2006 Author 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.
trids Posted January 6, 2006 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
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