Jump to content

Recommended Posts

Posted (edited)

Hai gus im a IT sudent and the other day i got a virus on my memory stick and it wiped all my coursework and i was pissed bcause i was going to make a back up the night before but i didnt and had to re-do all my work :@ but anyways i would like to develop a simple script to back my ICT folder every time i plug it into my home pc so it makes a backup of the it folder on my desktop and overwrites the old one i am extremely new to auto IT and programming itself and wouild like some help getting started on my first project !

Thanks very much in advance !

Edited by 117
Posted

Hai gus im a IT sudent

Hi!

If you are an IT student, you'll definitely know some other programming languages and are able to code. Skim through the AutoIt helpfile and start coding. If you reach a point at which you're stuck, return here, post your code and we will help.

Regards,

Chris

Posted

Hi this is how i think about how to go about it in non programing terms

When disk I:/= avalible

then

lookfor I:/ICT

then

select folder "ICT"

then

copy > C:\Documents and Settings\Rob\Desktop

and overwrite existing "ICT"

then exit.

Posted (edited)

Could try something like this

$Drives = DriveGetDrive( "all" )
$Destination = "C:\Documents and Settings\Rob\Desktop\ICT"
If NOT @error Then
    For $x = 1 to $Drives[0]
        If $Drives[$i] = "THUMB DRIVE NAME" Then
            FileRecycle($Destination)
            DirCopy($Drives[$x] & "\ICT", $Destination, 1)
            If @error Then
                MsgBox(0, "Error", "Error While Copying ICT Folder to Desktop.")
            EndIf
        EndIf
    Next
EndIf

Now that would copy it if you ran it once the thumb drive is in your computer you could just make a while loop and run it if you want it running all the time.

Edited by Onichan
Posted

hi thanks for your help putting it into Programming terms for me xD but when i ran it i got a error,

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\Rob\Desktop\Memory stick backup.au3"    
C:\Documents and Settings\Rob\Desktop\Memory stick backup.au3 (5) : ==> Variable used without being declared.:
If $Drives[$i] = "THUMB DRIVE NAME" Then
If $Drives[^ ERROR
>Exit code: 1    Time: 0.984

is that because

"THUMB DRIVE NAME"

needs to be set to I:\?

or is the varible wrong?

[$i]

thanks anyway i will try and tinker lol.
Posted (edited)

Oh sorry it was because I used wrong variable also I forgot for it to look up the drive label and heres what it should have been

$Drives = DriveGetDrive( "all" )
If NOT @error Then
    For $x = 1 to $Drives[0]
        $Name = DriveGetLabel($Drives[$x])
    If $Name = "CHANGEME" Then
    FileRecycle(@UserProfileDir & "\Desktop\ICT")
    DirCopy($Drives[$x] & "\ICT", @UserProfileDir & "\Desktop\", 1)
    If @error Then
    MsgBox(0, "Error", "Error While Copying ICT Folder to Desktop.")
    EndIf
    EndIf
    Next
EndIf

Now you do need to change the text CHANGEME to what ever your thumb drive is labeled for example "Local Disk" is default, but you have to change it and it has to be unique.

Also did a search and found out how to detect when your thumb drive is inserted by SkinnyWhiteGuy's post Here so you should just use that.

Edited by Onichan

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
  • Recently Browsing   0 members

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