Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

.bat files - syntax, maybe a little more advanced etc? Thanks

Options
  • 22-10-2009 9:20pm
    #1
    Closed Accounts Posts: 19,080 ✭✭✭✭


    I want to copy folder1 to folder2. I want to to continue if an error occurs. I want any errors to write to a log file.

    I have this at the moment but all it does it copy etc. I want something that's completely foolproof (or as much as possible) and I can leave it running for a few hours while it copys loads of data back and forth knowing that it won't fail etc.
    xcopy w:\0005\* x:\myfolder\0005 /Z /i /s
    


    Can someone help? Thanks


Comments

  • Registered Users Posts: 2,934 ✭✭✭egan007


    I'm no dos shell expert but I highly recommend downloading cygwin It runs unix shells on windows, these scripting languages are far far more powerful and easier to write scripts in.

    your code in ksh would be

    cp -r folder1 folder2


  • Registered Users Posts: 3,287 ✭✭✭padraig_f


    You want robocopy, it's part of Windows Server 2003 Resource Kit.

    I've got it doing what you describe, incremental backups with full logging of what was copied including summary. It has a lot of options.


  • Registered Users Posts: 2,894 ✭✭✭TinCool


    +1 for robocopy. Free and a hellofa lot better than the built in dos copy or xcopy commands.


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Additionally you could also use PowerShell


  • Registered Users Posts: 1,228 ✭✭✭carveone


    Ginger wrote: »
    Additionally you could also use PowerShell

    I'd second that. I mean if you intend using a Unix OS all the time then using Cygwin makes some kind of sense but I feel that if your on Windows, then use Windows technologies. When in Rome etc.

    To do what you are asking requires a little thought as to the app you use to copy files. On an error what will that app do? What type of error? If it's disk full or perm denied there's hardly any point in continuing. That type of thing.

    Even in KSH, you'd have to copy each file, one at a time, making sure each one completed and acting appropriately on each error. Which means you'd have to use "find" to create a file tree first and pipe it to "while read". These things are never as simple in scripting languages as we'd like them to be!


  • Advertisement
Advertisement