Advertisement
Ra7eN

2023 Minecraft Backup (Dropbox & Local) with auto dynamic IP update

Jan 1st, 2023 (edited)
1,782
0
Never
3
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.83 KB | Gaming | 0 0
  1. :: UPDATES
  2. :: Jan 2, 2023
  3. :: ADDED "/I" TO XCOPY. SEEMS TO KEEP CRASHING THERE FOR A FOLDER OR FILE
  4. :: I = DEFAULTS TO FOLDER IF IT DOES NOT EXISTS
  5. ::
  6. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7. :: ::::              B A C K U P . B A T                 ::::
  8. :: ::::            MINECRAFT SERVER BACKUP               ::::
  9. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10.  
  11. :: AUTHOR: R.SCORPIO rickscorpio64@gmail.com
  12. :: WEBSITE: https://rustycraftmc.blogspot.com/
  13. @echo off
  14. title "BACKUP SERVER"
  15.  
  16.  
  17.  
  18. :: ----------- EDIT THIS SECTION ------------------------------------
  19.     :: mc drive and directory
  20.     set mcdrive=c  
  21.     set mcfolder=c:\MinecraftServer
  22.    
  23.     :: put the name of the world you want to backup
  24.     set worldname=world
  25.    
  26.     :: BACKUP folder name
  27.     set backupDrive=c
  28.     set backupFolder=c:\MinecraftServer\backups
  29.    
  30.    `if not exist %backupfolder% mkdir %backupfolder%
  31. :: ---- DO NOT EDIT PAST HERE ---------------------------------------
  32. :backup
  33. cls
  34. echo "    _____                                          
  35. echo " __|___  |__  ______  _____  __    _ ______  _____  
  36. echo "|   ___|    ||   ___||     |\  \  //|   ___||     |
  37. echo " `-.`-.     ||   ___||     \ \  \// |   ___||     \
  38. echo "|______|  __||______||__|\__\ \__/  |______||__|\__\
  39. echo "   |_____|                                          
  40. echo "    _____                                          
  41. echo " __|___  |__  ____    ______  __  __  __   _  _____
  42. echo "|      >    ||    \  |   ___||  |/ / |  | | ||     |
  43. echo "|     <     ||     \ |   |__ |     \ |  |_| ||    _|
  44. echo "|______>  __||__|\__\|______||__|\__\|______||___|  
  45. echo "   |_____|                                          
  46.                                                
  47. echo.
  48.  
  49. :: get on the chosen backup drive
  50. %backupDrive%:
  51.  
  52. :: switch to backup folder
  53. cd "%backupFolder%\"
  54.  
  55. :: get current time
  56. for /f "tokens=2-4 delims=/ " %%a in ('DATE /T') do (set var=%%c-%%a-%%b)
  57. :: create a dated folder in the backup folder based on the date from above
  58. md %var%
  59.  
  60. :: start the backup
  61. echo Backing up %worldname% one moment...
  62.  
  63. :: change folder to your liking
  64. set dropboxTargetFolder=minecraft
  65.  
  66. :: get location of downloaded dropbox
  67. set dropbox=%userprofile%\dropbox
  68.  
  69. :: check to see if this folder exists, if not tell
  70. :: users to download it
  71. if not exist %dropbox% (
  72.     echo Get Dropbox for PC before using this!
  73.     goto :eof
  74. )
  75.  
  76. if not exist %dropbox%\%dropboxTargetFolder%\%var% mkdir %dropbox%\%dropboxTargetFolder%\%var%
  77.  
  78. if exist %dropbox%\%dropboxTargetFolder% xcopy /Y /e /c /exclude:%mcfolder%\exclude.txt "%mcfolder%\%worldname%\*.*" %dropbox%\%dropboxTargetFolder%\%var%
  79.  
  80. :: LOCAL Backup
  81. :: COPMMENT OUT THE FOLLOWING IF YOU DO NOT WANT TO BACKUP LOCAL
  82. :: RECOMMEND JUST KEEPING IT IN PLACE IF FOR SOME REASON YOU LOOSE I-NET ACCESS.
  83. xcopy /Y /e /c /i /exclude:%mcfolder%\exclude.txt "%mcfolder%\%worldname%\*.*" "%backupFolder%\%var%
  84.  
  85. echo Backup completed successfully..
  86. echo.
  87. echo Cleaning up backup folder
  88. :: we dont want anything longer than 7 days of back up. thats plenty.
  89. :: THIS WORKS FOR LOCAL BACKUP ONLY - NOT VERIFIED FOR DROPBOX (OR OTHER ONLINE BACKUP SERVICES)
  90. %backupDrive%:
  91. cd "%backupfolder%\"
  92. :: for info on FORFILES use FORFILES /?
  93. FORFILES /S /D -7 /C "cmd /c IF @isdir == TRUE rd /S /Q @path"
  94.  
  95. :: UPDATE IP ADDRESS (FOR DNSEXIT FREE IP REDIRECT)
  96. :: This will ensure that if my IP changes, it will automatically update the free DNS address
  97. ::
  98. :: To get updated script
  99. :: https://dnsexit.com/users/dns/dyn/
  100. echo Updating DNSEXIT (rustycraft.linkpc.net) IP forward address
  101. curl https://api.dnsexit.com/dns/ud/?apikey=k8mS1wGv8UY35oqIe7A49nXZrF9jAM -d host=rustycraft.linkpc.net
  102.  
  103.  
  104. :: get back to the minecraft folder
  105. :: some problems testing.. hard code this if vars do not work.
  106. :: %mcdrive%:
  107. c:
  108. cd "%mcfolder%"
  109. exit
Advertisement
Comments
  • Ra7eN
    1 year
    # text 0.09 KB | 0 0
    1. NEW FOR 2023 - backup batch file for your minecraft server. Put it on a windows Task schedule.
  • Ra7eN
    1 year
    # text 1.02 KB | 0 0
    1. HOW TO USE:
    2. This is probably one of the more elaborate backups for your minecraft servers.
    3. PRO'S
    4. - can back up to your local directory
    5. - can back up to a remote backup service - default is DROPBOX
    6. - If you use DNSEXIT (similar to no-ip BUT it is hands off, no need to keep logging in etc..)this will auto update your IP address
    7. - DOES NOT NEED TO HAVE SERVER SHUT DOWN TO BACKUP!
    8.  
    9. INSTALL
    10. - Make a batch file in your minecraft server root folder.
    11. - CREATE A FILE = "exclude.txt" with the following line session.lock then save it in your MC server directory.
    12. - make sure there is a backup folder (I have since fixed that in the batch file just sayin! LOL)
    13. - Edit folders in the 'EDIT THIS SECTION'
    14. - Edit the DNSEXIT from the site provided. If not used just delete or comment out that line
    15. - Edit the DROPBOX section 58, 70-74, if not used comment out or delete (if you have any other links for other remote backups, love to see them here
    16.  
    17. That's it. Test it by running it. Optional, make an entry in your windows TASK SCHEDULER.
  • Ra7eN
    1 year
    # text 0.11 KB | 0 0
    1. WOW did not realize the interest in this (good or bad). Say hi if you take a look at this, or comment. Thanks again!!
Add Comment
Please, Sign In to add comment
Advertisement