Jump to content

Copying a folder


Eambo
 Share

Recommended Posts

Hi Everyone,

I'm wondering what the best way to make a copy of a folder is. I want a prompt that asks a user if they want to make a backup, and should they hit yes it'll automate the process. So far I have this, but it doesn't want to work:

runwait(@comspec & "xcopy /s/e/i" & $InstallPath & "," & $InstallPath2 & "\Backup2")

But that just doesn't seem to want to work. Is there a built in method of doing this? If not, does anyone know what's wrong with the above?

Thanks! :-)

Link to comment
Share on other sites

See DirCopy() in the help file or try

runwait(@comspec & " xcopy /s/e/i" & $InstallPath & "," & $InstallPath2 & "\Backup2")

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

See DirCopy() in the help file or try

runwait(@comspec & " xcopy /s/e/i" & $InstallPath & "," & $InstallPath2 & "\Backup2")

Thanks very much. I tried DirCopy, however it didn't copy sub directories - was I possibly doing something wrong?

Also your code looked much more promising, it launched a command prompt window...but it just sat there and didn't copy anything unfortunately :-( Thanks for trying to help, much appreciated!

Edit: Aha! It looks like if the folder already exists, it will not copy the files. I had a DirCreate before it, thinking the directory needed to exist - removed this and it seems to be working!

Thanks for pointing me in the right direction! :-)

Edited by Eambo
Link to comment
Share on other sites

glad you found the answer. The help file will do wonders.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...