Jump to content
Sign in to follow this  
JamesDover

DirCopy On Windows 2003 Web Server

Recommended Posts

JamesDover

It runs but there is nothing copied we ran it just on c:\aaa to c:\bbb and it works fine. So it seems to be a rights issue which user rights does autoit use (system,user,admin,etc)? Also in theory it should copy's both folders and sub folders and then over-right everything in the destination?

Cheers

Global $source = ("c:\ftproot\test_site\aaaaaaaa\")

Global $destination = ("c:\inetpub\wwwroot\default\aaaaaaaa\")

If FileExists($source) And ($destination) Then

ProgressOn("Coping Files", "", "0 percent")

ProgressSet(0, "Backup " & $source & $destination)

Sleep(200)

ProgressSet(50)

Sleep(200)

$Copy = DirCopy($source, $destination, 1)

ProgressSet(75)

ProcessWaitClose($Copy)

ProgressSet(100, "Finished")

Sleep(200)

Else

MsgBox(262160, "Warning", "Directory Does Not Exist", 5)

EndIf

Edited by JamesDover

Share this post


Link to post
Share on other sites
PsaltyDS

It runs but there is nothing copied we ran it just on c:\aaa to c:\bbb and it works fine. So it seems to be a rights issue which user rights does autoit use (system,user,admin,etc)? Also in theory it should copy's both folders and sub folders and then over-right everything in the destination?

Cheers

Global $source = ("c:\ftproot\test_site\aaaaaaaa\")
Global $destination = ("c:\inetpub\wwwroot\default\aaaaaaaa\")
If FileExists($source) And ($destination) Then
ProgressOn("Coping Files", "", "0 percent")
ProgressSet(0, "Backup " & $source & $destination)
Sleep(200)
ProgressSet(50)
Sleep(200)
$Copy = DirCopy($source, $destination, 1)
ProgressSet(75)
ProcessWaitClose($Copy)
ProgressSet(100, "Finished")
Sleep(200)
Else
MsgBox(262160, "Warning", "Directory Does Not Exist", 5)
EndIf
Well, this syntax is wrong:
; If FileExists($source) And ($destination) Then
; Should be:
If FileExists($source) And FileExists($destination) Then

And the use of $Copy is wrong because DirCopy() returns 0 or 1 for success, not a PID, so using it for ProcessWaitClose() is pretty silly.

There have been many discussions of doing copies with a progress box, and this method is not one of the working ones...

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
JamesDover

Thanks PsaltyDs for the information. Which method do you prefer?

Edited by JamesDover

Share this post


Link to post
Share on other sites
SmOke_N

Thanks PsaltyDs for the information. What method do you prefer?

I'm going to take a step out on a limb here and say he prefers:

one of the working ones...


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
PsaltyDS

I'm going to take a step out on a limb here and say he prefers:

Yeah. :D

My point was to use search and find one the many.

The only time I worried about a progress bar myself, I did it with a total top level directory count and just showed percentage of directories completed. The recursive directory walking function I wrote myself. This was a folder with about 2000 sub folders at the first level under it, about 2 million files and 1TB total. With smaller stuff the progress bar isn't really interesting to me.

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.