am632 Posted March 2, 2011 Share Posted March 2, 2011 Hi, Im using xcopy to copy a folder to another folder, but it would seem that all files/folders with a space in the name is being missed. Heres ma code... RunWait(@ComSpec & ' /c xcopy /e /h /y /i "' & $SETDOCUMENTSDIR & '" "' & $TEMPFOLDER & "\Documents" & '"', "", @SW_HIDE) All foles/folders without spaces get copied with no problems, but anything with a space in the name gets skipped from the copy. What am i doing wrong? thanks Link to comment Share on other sites More sharing options...
ripdad Posted March 3, 2011 Share Posted March 3, 2011 Try this ... ; source and destination folders must exist Local $dir1 = 'somefolder', $dir2 = 'someotherfolder' RunWait('xcopy.exe "' & $dir1 & '" "' & $dir2 & '" /e /c /h /r /k /y /d', @SystemDir, @SW_HIDE) "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
am632 Posted March 3, 2011 Author Share Posted March 3, 2011 Hi thanks for the reply. This worked very well, alot better than mine but i had to add the perameter '/d' as it was waiting in the hidden command window. Once the copy finished tho, i compaired the original folder properties against the new 1 and there seems to be some files and a couple of folders missing but im having trouble finding out what exactly is missing and why. do u have any ideas? thanks again Link to comment Share on other sites More sharing options...
ripdad Posted March 4, 2011 Share Posted March 4, 2011 I have never had any troubles with the code I posted. Been using it for years. Can you elaborate what files and folders are missing? Also, can you post the code you tried, so we might reproduce the problem? "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
ChrisL Posted March 4, 2011 Share Posted March 4, 2011 (edited) Hi thanks for the reply. This worked very well, alot better than mine but i had to add the perameter '/d' as it was waiting in the hidden command window. Once the copy finished tho, i compaired the original folder properties against the new 1 and there seems to be some files and a couple of folders missing but im having trouble finding out what exactly is missing and why. do u have any ideas? thanks again Just use Autoit.. _DirCopy("C:\Folder A","C:\Folder B") Func _DirCopy($Source,$Destination) Local $Search = FileFindFirstFile($Source & "\*") If $Search = -1 then Return While 1 $file = FileFindNextFile($Search) If @error then ExitLoop If StringInStr(FileGetAttrib($Source & "\" & $file),"D") then DirCreate($Destination & "\" & $file) _DirCopy($Source & "\" & $file, $Destination & "\" & $file) Else If FileExists($Destination & "\" & $file) then FileSetAttrib($Destination & "\" & $file,"-R") FileCopy($Source & "\" & $file, $Destination & "\" & $file,9) EndIf WEnd FileClose($Search) EndFunc Edited March 4, 2011 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
rudi Posted March 4, 2011 Share Posted March 4, 2011 Hi. For syncing folders, use robocopy.exe Up to version XP026 robocopy provides exitcodes, these tell exactly what happened (or went wrong). The versions starting with that one in robocopyGUI unfortunately do *NOT* provide exitcodes any more. Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! 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