Sign in to follow this  
Followers 0
forst

Backing up script

4 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Arterie

Share this post


Link to post
Share on other sites

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.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

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

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  
Followers 0