anybastard Posted September 26, 2011 Share Posted September 26, 2011 Hi Guys , i lost in "simple" dircopy function here the code expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $From_BigOne Global $From_Multi Global $To_BigOne Global $To_Multi $Form1 = GUICreate("MTR", 260, 105, 192, 114) $Source = GUICtrlCreateCombo("", 24, 29, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "A:\|B:\|C:\|D:\|E:\|F:\|G:\|H:\|I:\|J:\|K:\|L:\|M:\|N:\|O:\|P:\|Q:\|R:\|S:\|T:\|U:\|V:\|W:\|X:\|Y:\|Z:\") $Destination = GUICtrlCreateCombo("", 143, 29, 89, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "A:\|B:\|C:\|D:\|E:\|F:\|G:\|H:\|I:\|J:\|K:\|L:\|M:\|N:\|O:\|P:\|Q:\|R:\|S:\|T:\|U:\|V:\|W:\|X:\|Y:\|Z:\") $Label1 = GUICtrlCreateLabel("Source:", 24, 8, 41, 17) $Label2 = GUICtrlCreateLabel(" Destination:", 143, 8, 63, 17) $Test = GUICtrlCreateButton("Run Test", 24, 65, 89, 25) $Log = GUICtrlCreateButton("Advanced Log", 143, 65, 89, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Test $From = GUICtrlRead ($Source) $To = GUICtrlRead ($Destination) if $From == $To Then MsgBox (16, "Error", " Source and Destination path cannot be the same " ) Else $From_BigOne = DirCreate ($From & "Test\Big") $From_Multi = DirCreate ($From & "Test\Multi") $To_BigOne = DirCreate ($To & "Test\Big") $To_Multi = DirCreate ($To & "Test\Multi") ;Start the time and copy files $timer = TimerInit() Dircopy ($From_BigOne , $To_BigOne ) MsgBox(0,"Total Time to complete all tasks",TimerDiff($timer)/1000) in this code dircopy function doesn't work and i don't understand the reason By the way ... here $From & "Test\Big" is present a single file and here $From & "Test\Multi" are present several files Can you help me to discover my error ?? My Os is W7 x64 Thanks a lot AnyB Link to comment Share on other sites More sharing options...
sleepydvdr Posted September 26, 2011 Share Posted September 26, 2011 (edited) I think your problem is with this line: Dircopy ($From_BigOne , $To_BigOne ) $From_BigOne and $To_BigOne references the creation of a directories, not the directories themselves. Try using referencing the directory location like so or create another variable to reference it: Dircopy ($From & "Test\Big" , $To & "Test\Big") Edited September 26, 2011 by sleepydvdr #include <ByteMe.au3> Link to comment Share on other sites More sharing options...
anybastard Posted September 26, 2011 Author Share Posted September 26, 2011 Hi , first for all thanks for your answer i tried your way but unfortunatly doesn't work AnyB, Link to comment Share on other sites More sharing options...
sleepydvdr Posted September 26, 2011 Share Posted September 26, 2011 Looking a bit closer at your code, I don't understand it. You select a "From" and "To". Then you click copy and it creates a folder in each of those directories, each of them called "Big". Then you copy the "Big" folder from one drive to the other. If you just created that folder, then there is nothing in it, so there is nothing to copy. Or am I missing something? #include <ByteMe.au3> Link to comment Share on other sites More sharing options...
anybastard Posted September 26, 2011 Author Share Posted September 26, 2011 (edited) hi yes you are right there is a missing code after dircreate . The missing code create inside $From "Test\Big only a file and inside $From "Test\Multi several files ( and this work fine ) In other words - select source and destination by combobox and save them into $From and $To variables ( all work fine ) - check if $From and $To are the same , if yes generate a msg box with error ( works fine ) - Generate a structure in $from with dircreate () like Test\Big and Test multi ( work fine ) - Generate a structure in $To with dircreate () like Test\Big and Test multi ( work fine but this is optional becouse dircopy could be recreate them if possible ) - Generate a file and put it into Test\Big ( work fine ) - Generate a file and put it into Test\Multi ( work fine ) - Generate a Msgbox when all is ok and start the timer when i press Ok ( work fine ) - I would like copy $from Test\big content and $from Test\Multi in $To BUT THIS STEP DOESN'T WORK AND I DON'T KNOW THE REASON this evening i Trying to solve this problem but at the moment all is the same doesn't work Best Regards AnyB Edited September 26, 2011 by anybastard Link to comment Share on other sites More sharing options...
sleepydvdr Posted September 26, 2011 Share Posted September 26, 2011 If you are running Vista/7, it may be blocking you from copying to the root of the folder. I have had similar troubles with that before. Try this: compile the script and right-click it and run it as administrator. Then try your copying that has been failing. If it works, then that's your problem. #include <ByteMe.au3> 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