redfive19 Posted October 12, 2005 Share Posted October 12, 2005 Hello all, Trying to do a simple directory copy and DirCopy is NOT copying the folder structure underneath the folder I am copying. DirCopy("D:\Documents and Settings\jermaid\My Documents", "C:\testcopy", 1) When I run this, it only copies the files from the root of My Documents but not the folders in the My Documents folder. I have a strange feeling that I am missing something real simple here. Would someone slap me into reality and tell me what I am doing wrong? Regards, Redfive Link to comment Share on other sites More sharing options...
CyberSlug Posted October 12, 2005 Share Posted October 12, 2005 What version of AutoIt and Windows? -You might want to check the return value. -You might try doing a copy and paste in explorer. If explorer thinks some file is "in use"--usually due to some invalid locking handle--then the copy might abort. $source = "D:\Documents and Settings\jermaid\My Documents" $destination = "C:\testcopy" $result = DirCopy($source, $destination, 1);1==overwrite MsgBox(4096,"Result", $result) DirCopy worked for me as expected on 3.1.1.0 on WinXP Pro sp2 Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
redfive19 Posted October 12, 2005 Author Share Posted October 12, 2005 Well I have the newest Autoit (3.1.1) installed and the newest beta. I tried it using a BetaRun and a regular run. I'll try it with the code you posted. Link to comment Share on other sites More sharing options...
redfive19 Posted October 12, 2005 Author Share Posted October 12, 2005 well, you were right....it came up with an error. now to find out why! Link to comment Share on other sites More sharing options...
redfive19 Posted October 12, 2005 Author Share Posted October 12, 2005 so far, no problems copying via explorer, waiting for one to crop up actually. maybe autoit approaches the directory copies differently then explorer and explorer will hit the bump at a different time! Link to comment Share on other sites More sharing options...
redfive19 Posted October 12, 2005 Author Share Posted October 12, 2005 (edited) Okay since both AutoIt & XCOPY encountered problems (while explorer did not) this is the command that finally worked for me Runwait(@ComSpec & " /c " & "xcopy " & '"' & $source & '"' & ' "' & $destination & '"' & " /E /C") I know I can also hide the window but i'd rather leave it up to show that it's working (that whole progress bar still boggles my mind!!!) Now on a complete side note, how do you change the color of the DOS window that pops up? I know the COLOR command does it but how do you pass it on to the window before you run XCOPY? thanks for your help! -redfive Edited October 12, 2005 by redfive19 Link to comment Share on other sites More sharing options...
Skruge Posted October 12, 2005 Share Posted October 12, 2005 (edited) I know the COLOR command does it but how do you pass it on to the window before you run XCOPY?CMD.EXE recognizes the ampersand character to run commands sequentially. You can also use && to only run the following command if the first succeeds, || to run only if the first fails. Try this: Run(@ComSpec & ' /c color 2e & xcopy "'' & $source & ' "' & $destination & '" /E /C') btw, I haven't had any issues at all with DirCopy().Edit: You can also pass the /T:xx parameter to CMD.exe instead of using COLOR.This parameter and the Ampersand syntax will not work in 9x, which use command.com. Edited October 12, 2005 by Skruge [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] 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