forst Posted July 16, 2009 Share Posted July 16, 2009 Hello all, i need help with a small script which will backup a whole drive e.g. D:\ into local disc. I already wrote some but it dont works as I want. it use DirCopy function with nooverwrite like this: DirCopy("d:\", "c:\backup\d\" & @UserName, 0) this work great until I put another CD, then because the directory c:\backup\d\ already exists on the disc, the script will not copy any file if i use DirCopy("d:\", "c:\backup\d\" & @UserName, 1) then it works with new CD but it overwrits files still around (I have a loop in the script) and it take too much CPU even if i put sleep (10000). Here is whole script: $i=0 do $varCD = DriveStatus( "d:\" ) if $varUSB = "READY" then DirCopy("d:\", "c:\d\" & @UserName, 1) endif sleep (10000) until $i=1 Thank you for help. Link to comment Share on other sites More sharing options...
Arterie Posted July 16, 2009 Share Posted July 16, 2009 (edited) Even if i dont see the sense of using a loop for this you could do it like this: Because in your script the loop would never end because $i would never become 1 since you never add 1 to $i $i=0 do $varCD = DriveStatus( "d:\" ) if $varUSB = "READY" then DirCopy("d:\", "c:\d\" & @UserName, 1) endif sleep (10000) $i += 1 until $i=1 Edited July 16, 2009 by Arterie Link to comment Share on other sites More sharing options...
dantay9 Posted July 16, 2009 Share Posted July 16, 2009 A better way to split up the drive into smaller parts is to do a folder search, nonrecursive. First copy all files in the root directory of the drive to the backup directory. Then do a nonrecursive search for the folders in the root. You can then copy each folder separately to the backup directory. In between each folder copy, you can sleep to lower the cpu usage. If the cpu is still too high, just split up each folder using these steps. Link to comment Share on other sites More sharing options...
forst Posted July 17, 2009 Author Share Posted July 17, 2009 thanks dantay9, it seem it should works like you say, but i am not so skilled in AutoIt, so can you pls show me some small example? Thank you 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