Borje Posted November 16, 2014 Share Posted November 16, 2014 Hello all users I need little help with this command what I want is this not should owerwrite files in $indest folder what can I do? $runcmd = @ComSpec & " /c copy /y " & chr(34) & $insource & chr(34) & " " & Chr(34) & $indest & Chr(34) My $insource dir is : d:backup1 and my $indest is: d:backup2 This works but that not need to owerwrite the files in dest folder on every run. Perhaps somebody have a tips.. Regards Borje Link to comment Share on other sites More sharing options...
Danyfirex Posted November 16, 2014 Share Posted November 16, 2014 why not filecopy? Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Borje Posted November 16, 2014 Author Share Posted November 16, 2014 Hello Danyfirex I am not sure how to convert this to filecopy do you have som example? Link to comment Share on other sites More sharing options...
mikell Posted November 16, 2014 Share Posted November 16, 2014 FileCopy("d:\backup1\*.*", "d:\backup2\") RTFM Link to comment Share on other sites More sharing options...
Developers Jos Posted November 16, 2014 Developers Share Posted November 16, 2014 Hello Danyfirex I am not sure how to convert this to filecopy do you have som example?did you really open the helpfile and have issues coding this after reading it ? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Borje Posted November 16, 2014 Author Share Posted November 16, 2014 Yes i have do that but cant have this to work the filecopy not works to but if that are somebody that help me with this $runcmd = @ComSpec & " /c copy /y " & chr(34) & $insource & chr(34) & " " & Chr(34) & $indest & Chr(34) To have that to not owerwrite the destination files.. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 16, 2014 Developers Share Posted November 16, 2014 Open the helpfile, check for filecopy and read. Code the command and test. Come back when you have issues and show us the code you have. Simple enough ..right ? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Borje Posted November 16, 2014 Author Share Posted November 16, 2014 Here is the code! CopyFiles.au3 Link to comment Share on other sites More sharing options...
Developers Jos Posted November 16, 2014 Developers Share Posted November 16, 2014 mmmm looks like you have already done quite some coding. So what is the issue exactly? Do you only want to replace files in the target directory when the source is changed? When that is the case you could use xcopy and use the /D parameter. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
mikell Posted November 16, 2014 Share Posted November 16, 2014 ? echo n|copy /-y <source> <dest> Link to comment Share on other sites More sharing options...
Borje Posted November 16, 2014 Author Share Posted November 16, 2014 Hello Jos and others What I want is when I do a backup from the target folder to the destinaton folder the files in destinaton folder not be owerwitten i think that must be some trick with the @comsec or something.. As function now all files be owerwritten but I not need that... Link to comment Share on other sites More sharing options...
mikell Posted November 16, 2014 Share Posted November 16, 2014 Didn't you see my last post ? here is the trick This : $runcmd = @ComSpec & " /c echo n|copy /-y " & chr(34) & $insource & chr(34) & " " & Chr(34) & $indest & Chr(34) will cause a prompt to overwrite ( /-y ) with an automatic 'no' answer ( echo|n ) Link to comment Share on other sites More sharing options...
Borje Posted November 16, 2014 Author Share Posted November 16, 2014 Hi mikell Thanks for your trick I have test little but I think it still owerrite files I se that on time have you tested this? Link to comment Share on other sites More sharing options...
TheSaint Posted November 17, 2014 Share Posted November 17, 2014 (edited) Jos gave you your answer, use Xcopy instead of Copy in your command string, and use the /D parameter. Check xcopy out at the DOS prompt, if you need to. P.S. Or you could code some file checking (exists, size and date comparisons), and thus use the AutoIt function - FileCopy. Edited November 17, 2014 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
mikell Posted November 17, 2014 Share Posted November 17, 2014 I have test little but I think it still owerrite files I se that on time have you tested this? I tested using txt files with same names but different contents and it works on my XP - the content of files in dest folder doesn't change Link to comment Share on other sites More sharing options...
Borje Posted November 17, 2014 Author Share Posted November 17, 2014 Hello mikell Thanks for your helping me with this I also try xcopy but Cant have this to work perhaps that are something in the code I have not write all in this code. have problem with progress bar. I have also test with a textfile with same name an change the content in the source but it update the destination also owerwrite have you tested the code I uploaded ? Link to comment Share on other sites More sharing options...
DarkwarlorD Posted November 17, 2014 Share Posted November 17, 2014 (edited) @Borje, you can try this: $fileSrc = FileSelectFolder("Select the Source folder", "C:\") $fileDst = FileSelectFolder("Select the Destination folder", "C:\") If FileCopy($fileSrc, $fileDst) Then MsgBox(0, "Success", "Files Copied with SUCCESS!" & @CRLF & "No files overwrited") Else MsgBox(0, "Failure", "Something wrong happened!") EndIf Tell me if works to you, for me it's working And if you need to copy Directory and sub-directories, use DirCopy instead FileCopy Edited November 17, 2014 by DarkwarlorD Link to comment Share on other sites More sharing options...
Borje Posted November 17, 2014 Author Share Posted November 17, 2014 Hello Darkwarlor Your example works but I still have problem in my main script and I cant find any solution. 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