Batch script help

Discussion in 'Bukkit Help' started by sharkck, Aug 8, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    sharkck

    I use a batch file to create backups of my server files. It has worked wonderfully and still does except for one thing. I use DynMap. That was ok until the amount of files full of the map data just kept building up and building up and so on and so forth.... I now have over 30,000 map data files and I DO NOT want them to be included in my backup. I only need this copied over once... not every time I run my backup script. Is there a way I can exclude a directory from being copied through the xcopy command?

    Here is my .bat file:
    Code:
    @[URL='http://forums.bukkit.org/members/echo.48566/']Echo[/URL] off
    :: variables
    set drive=D:\Games\Minecraft\Backup
    set folder=world %date:~10,4%_%date:~4,2%_%date:~7,2%
    :: %date:~7,2%
    set backupcmd=xcopy /s /c /d /e /h /i /r /k /y
    
    echo ### Backing up directory...
    %backupcmd% "D:\Games\Minecraft\Bukkit" "%drive%\%folder%"
    
    echo Backup Complete!
    @pause
    
    The path to dynmap's map tiles is: D:\Games\Minecraft\Bukkit\plugins\dynmap\web\tiles

    I am running this using windows 7 pro, 64 bit.

    Thanks in advance for your help!
     
  2. Offline

    Supersam654

    If you open up CMD and type xcopy /?, you will clearly see a list of everything you can do with xCopy. One of them happens to be /exclude:YOURFILEHERE. In that file, you should put folders that you do not want to copy. So if you didn't want to include the dynmap directory, I would use
    Code:
    xcopy /WhateverYouAreUsing /EXCLUDE:exclusion.txt
    Inside your exclusion.txt file (which in this case is located at the same location as your batch file) your first line would read:
    Code:
    D:\Games\Minecraft\Bukkit\plugins\dynmap\web\tiles
    If you wanted to exclude other things, then put those paths on a separate line.
     
  3. Offline

    sharkck

    Awesome deal! Everything works great! Hope this helps anybody else that is looking for something similar!
     
Thread Status:
Not open for further replies.

Share This Page