Bkup script

Discussion in 'Scripting' started by cyberbot, Jul 28, 2012.

  1. cyberbot

    cyberbot MDL Senior Member

    Jul 30, 2011
    463
    20
    10
    #1 cyberbot, Jul 28, 2012
    Last edited: Jul 28, 2012
    Hey Guys,
    i am looking for some help, i need to create a .bat script that runs ( Xcopy) back up from a drive to drive, and after it finish copying the files it shut the pc down,
    can someone please help me create this?

    thank you guys
     
  2. PhaseDoubt

    PhaseDoubt MDL Expert

    Dec 24, 2011
    1,448
    278
    60
    #2 PhaseDoubt, Jul 28, 2012
    Last edited: Jul 28, 2012
    I just use Notepad to create a batch file containing the [DOS] backup command and run that batch file at specified times via Task Scheduler.

    A very simple example to copy all file to my E:\Backups\<username> folder is:
    copy *.* E:\Backups\<username>

    I put the batch file directly into the My Documents folder and set it to start in that folder.

    I also use other backup programs routinely, but the batch file runs at least once per day (and when I run it via shortcut if I choose) and the file copies are readable directly by the program in which they were created. For quick backups, I like the idea of simple copies.

    An example of an xcopy command that works is:
    xcopy /y /s /c /I /v D:\UserData\<username> u:\xcopyb~1\<foldername>\xcopybak7

    All my data is maintained on my drive/partition D: by default and xcopy backed up to my U: drive and given the name "xcopybak7". Again run via Task Scheduler or shortcut when needed.
     
  3. thatguychuck

    thatguychuck MDL Member

    Feb 6, 2011
    100
    34
    10
  4. cyberbot

    cyberbot MDL Senior Member

    Jul 30, 2011
    463
    20
    10
    #4 cyberbot, Jul 28, 2012
    Last edited: Jul 28, 2012
    (OP)
    Thank you so much,
    it helped me the script,
    i created the bat script and add it at the end of it
    shutdown -s
     
  5. PhaseDoubt

    PhaseDoubt MDL Expert

    Dec 24, 2011
    1,448
    278
    60
    My pleasure! :biggrin:
     
  6. cyberbot

    cyberbot MDL Senior Member

    Jul 30, 2011
    463
    20
    10
    is it possible also to help programming script with robocopy?
     
  7. PhaseDoubt

    PhaseDoubt MDL Expert

    Dec 24, 2011
    1,448
    278
    60
    #7 PhaseDoubt, Jul 30, 2012
    Last edited: Jul 30, 2012
    No idea. I just stick with the simplest things I can find and for me in this case, for my purposes, that's Notepad, a simple batch file and Task Scheduler. And a shortcut or two to run the batch files on demand.

    I've been doing that since the early days of DOS. Surprisingly enough, those early batch files still work to do exactly what I want to do now. That's real ease of use and compatibility.

    Edit: Just did a little research on robocopy and it looks to be pretty much a vastly enhanced version of the copy command. Many switches to customize the copy process. I doubt I'll do anything with it since all my batch files do what I want, but if I were just starting out, I'd definitely try it.