Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › How do I make a .BAT script to copy the contents of one folder to another?
New Posts  All Forums:Forum Nav:

How do I make a .BAT script to copy the contents of one folder to another?

post #1 of 9
Thread Starter 
Hello I'm looking for a way to make automatic backups of my Minecraft Server which is run off a RAMDisk.

I've figured out how to schedule tasks to run automatically with the Windows Scheduler, and I've hit a wall so to speak in my abilities. I know barely anything about creating .bat files or commands for the command prompt.

So, I'm asking you guys here for some help

I need to know how to create a script to copy my server folder to a folder on my hard drive. The location of the server folder is Z:\\Minecraft Server and I would like for it to be copied to C:\\Server Backups.

Can someone tell me how to do this, or where to learn it myself? I'm sure it's not all too difficult but I don't know where to begin and don't want to make a mistake.


The computer I'll be doing this on is running Windows XP Professional SP3. If any more info is needed, feel free to say so in a post and I'll provide it.



Oh, btw. You're all welcome to play on my server if you'd like to.
For those interested, the IP is 67.247.39.41:25565
And my post on MinecraftForum is http://www.minecraftforum.net/topic/...kit-pvp-warps/
Edited by Shadow11377 - 10/29/11 at 4:21pm
i7 Sandy
(8 items)
 
Skylake Pentium
(8 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K ASRock Z75 Pro3 GTX 970 16GB 
Hard DriveOSMonitorPower
250GB Samsung 850 Evo WinXP Pro / Win7 Pro 1080p 60Hz Thermaltake Smart M850W 
CPUMotherboardGraphicsRAM
Pentium G4400 ASRock H110M-HDV GTX 550 Ti 8GB (2x4) 
Hard DriveOSPowerOther
250GB SSD Windows 7 500W 300Mbps WLAN 
  hide details  
Reply
i7 Sandy
(8 items)
 
Skylake Pentium
(8 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K ASRock Z75 Pro3 GTX 970 16GB 
Hard DriveOSMonitorPower
250GB Samsung 850 Evo WinXP Pro / Win7 Pro 1080p 60Hz Thermaltake Smart M850W 
CPUMotherboardGraphicsRAM
Pentium G4400 ASRock H110M-HDV GTX 550 Ti 8GB (2x4) 
Hard DriveOSPowerOther
250GB SSD Windows 7 500W 300Mbps WLAN 
  hide details  
Reply
post #2 of 9
Eh. I was going to say use Robocopy, but I don't think Windows XP has Robocopy. Only Vista and Windows 7.

I'd look into using xcopy.
post #3 of 9
I think there is going to be a little more to this, assuming you did just copy it, you would just keep replacing the old backup with the new one. I'm not sure if this is what you are planning on doing, but typically if you're doing a backup of the server then you probably want multiple backups. If you want it to be somewhat simple, I don't think your going to be able to do it for multiple backups.

Please clarify this if I misunderstood.
Be Rock Steady
(19 items)
 
  
CPUMotherboardGraphicsRAM
i7-2600K 4.7ghz @ 1.33 ASUS P8Z68 Deluxe Titan X Corsair Vengeance 16GB PC12800 DDR3 
Hard DriveHard DriveHard DriveCooling
Corsair Force CSSD-F115GB Seagate 1tb Western Digital 3TB bare H100 
OSMonitorKeyboardPower
Windows 7 Home Premium qnix kul es-87 Cooler Master Silent Pro M850 
CaseMouseAudioAudio
Corsair Obsidian 800D Razer Deathadder BE Schiit Audio Bifrost Uber Schiit Audio Lyr 2 
Audio
Audeze LCD-2 
  hide details  
Reply
Be Rock Steady
(19 items)
 
  
CPUMotherboardGraphicsRAM
i7-2600K 4.7ghz @ 1.33 ASUS P8Z68 Deluxe Titan X Corsair Vengeance 16GB PC12800 DDR3 
Hard DriveHard DriveHard DriveCooling
Corsair Force CSSD-F115GB Seagate 1tb Western Digital 3TB bare H100 
OSMonitorKeyboardPower
Windows 7 Home Premium qnix kul es-87 Cooler Master Silent Pro M850 
CaseMouseAudioAudio
Corsair Obsidian 800D Razer Deathadder BE Schiit Audio Bifrost Uber Schiit Audio Lyr 2 
Audio
Audeze LCD-2 
  hide details  
Reply
post #4 of 9
Not 100% sure but try this, i'll set a folder by the date(so you do it like once a day)
Code:
@Echo off
md "C:\\Server Backups\\%date:~10,4%_%date:~4,2%_%date:~7,2%"
xcopy /E "Z:\\Minecraft Server" "C:\\Server Backups\\%date:~10,4%_%date:~4,2%_%date:~7,2%"
Echo Done.
pause
hopefully that runs on xp xD as i only have win 7

I made it so you could do multiple a day and made it shorter

Code:
@Echo off
Echo D|xcopy /E "Z:\\Minecraft Server" "C:\\Server Backups\\%date:~10,4%_%date:~4,2%_%date:~7,2%\\%TIME:~0,2%-%TIME:~3,2%-%TIME:~6,2%"
Echo Done.
pause

Edited by Gooberman - 10/29/11 at 9:43am
le computer
(14 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 3570k  ASRock Z77 Extreme4 Sapphire R9 290x G.SKILL Ares Series 16 GB(4x4GB) 
Hard DriveHard DriveOptical DriveCooling
Crucial M4 Western Digital WD Blue 1TB ASUS 24X DVD Burner Swiftech H220 
OSKeyboardPowerCase
Windows 7 professional 64 Bit Das Keyboard DASK3PROMS1 SeaSonic X750 Corsair Vengeance Series C70 Gunmetal Black 
MouseAudio
Logitech G9x Sennheiser HD 518 
  hide details  
Reply
le computer
(14 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 3570k  ASRock Z77 Extreme4 Sapphire R9 290x G.SKILL Ares Series 16 GB(4x4GB) 
Hard DriveHard DriveOptical DriveCooling
Crucial M4 Western Digital WD Blue 1TB ASUS 24X DVD Burner Swiftech H220 
OSKeyboardPowerCase
Windows 7 professional 64 Bit Das Keyboard DASK3PROMS1 SeaSonic X750 Corsair Vengeance Series C70 Gunmetal Black 
MouseAudio
Logitech G9x Sennheiser HD 518 
  hide details  
Reply
post #5 of 9
Thread Starter 
Quote:
Originally Posted by Gooberman View Post
Not 100% sure but try this, i'll set a folder by the date(so you do it like once a day)
Code:
@Echo off
md "C:\\Server Backups\\%date:~10,4%_%date:~4,2%_%date:~7,2%"
xcopy /E "Z:\\Minecraft Server" "C:\\Server Backups\\%date:~10,4%_%date:~4,2%_%date:~7,2%"
Echo Done.
pause
hopefully that runs on xp xD as i only have win 7

I made it so you could do multiple a day and made it shorter

Code:
@Echo off
Echo D|xcopy /E "Z:\\Minecraft Server" "C:\\Server Backups\\%date:~10,4%_%date:~4,2%_%date:~7,2%\\%TIME:~0,2%-%TIME:~3,2%-%TIME:~6,2%"
Echo Done.
pause

This has worked perfectly for me. Thanks a lot!
This will surely save me a lot of time and regret if I ever forgot to do it manually and something bad happened.
i7 Sandy
(8 items)
 
Skylake Pentium
(8 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K ASRock Z75 Pro3 GTX 970 16GB 
Hard DriveOSMonitorPower
250GB Samsung 850 Evo WinXP Pro / Win7 Pro 1080p 60Hz Thermaltake Smart M850W 
CPUMotherboardGraphicsRAM
Pentium G4400 ASRock H110M-HDV GTX 550 Ti 8GB (2x4) 
Hard DriveOSPowerOther
250GB SSD Windows 7 500W 300Mbps WLAN 
  hide details  
Reply
i7 Sandy
(8 items)
 
Skylake Pentium
(8 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K ASRock Z75 Pro3 GTX 970 16GB 
Hard DriveOSMonitorPower
250GB Samsung 850 Evo WinXP Pro / Win7 Pro 1080p 60Hz Thermaltake Smart M850W 
CPUMotherboardGraphicsRAM
Pentium G4400 ASRock H110M-HDV GTX 550 Ti 8GB (2x4) 
Hard DriveOSPowerOther
250GB SSD Windows 7 500W 300Mbps WLAN 
  hide details  
Reply
post #6 of 9
np, got to do something worth while today
le computer
(14 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 3570k  ASRock Z77 Extreme4 Sapphire R9 290x G.SKILL Ares Series 16 GB(4x4GB) 
Hard DriveHard DriveOptical DriveCooling
Crucial M4 Western Digital WD Blue 1TB ASUS 24X DVD Burner Swiftech H220 
OSKeyboardPowerCase
Windows 7 professional 64 Bit Das Keyboard DASK3PROMS1 SeaSonic X750 Corsair Vengeance Series C70 Gunmetal Black 
MouseAudio
Logitech G9x Sennheiser HD 518 
  hide details  
Reply
le computer
(14 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 3570k  ASRock Z77 Extreme4 Sapphire R9 290x G.SKILL Ares Series 16 GB(4x4GB) 
Hard DriveHard DriveOptical DriveCooling
Crucial M4 Western Digital WD Blue 1TB ASUS 24X DVD Burner Swiftech H220 
OSKeyboardPowerCase
Windows 7 professional 64 Bit Das Keyboard DASK3PROMS1 SeaSonic X750 Corsair Vengeance Series C70 Gunmetal Black 
MouseAudio
Logitech G9x Sennheiser HD 518 
  hide details  
Reply
post #7 of 9
Just out of curiosity, since you seem to be using bukkit, why are you not using a plugin to accomplish this?
eyefinity
(22 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 2600K EVGA E685 Radeon HD 6970 Radeon HD 6970 
RAMRAMHard DriveCooling
G.Skill SNIPER G.Skill SNIPER Crucial M4 128GB 6970 EK Water Block Acetal + Nickel 
CoolingCoolingCoolingOS
Swiftech MCR320-QP Radiator Swiftech MCP655 Pump EK Supreme HF CPU Block Windows 7 Ultimate 
MonitorMonitorMonitorKeyboard
Dell E228WFP Dell E228WFP Dell P2210 G510 
PowerCaseMouseMouse Pad
TX850 HAF932 BE G500 XTRAC PADS Ripper 
Audio
G930 
  hide details  
Reply
eyefinity
(22 items)
 
  
CPUMotherboardGraphicsGraphics
Intel Core i7 2600K EVGA E685 Radeon HD 6970 Radeon HD 6970 
RAMRAMHard DriveCooling
G.Skill SNIPER G.Skill SNIPER Crucial M4 128GB 6970 EK Water Block Acetal + Nickel 
CoolingCoolingCoolingOS
Swiftech MCR320-QP Radiator Swiftech MCP655 Pump EK Supreme HF CPU Block Windows 7 Ultimate 
MonitorMonitorMonitorKeyboard
Dell E228WFP Dell E228WFP Dell P2210 G510 
PowerCaseMouseMouse Pad
TX850 HAF932 BE G500 XTRAC PADS Ripper 
Audio
G930 
  hide details  
Reply
post #8 of 9
Thread Starter 
Quote:
Originally Posted by morethantoast View Post
Just out of curiosity, since you seem to be using bukkit, why are you not using a plugin to accomplish this?
I don't like how often plug-ins get updated or outdated, and I'm keeping Windows XP for the foreseeable future. For something as simple as an automatic backup script ran with the Windows Task Scheduler, I don't feel I need a server plug-in. This method will not fail me, and I am also looking into hosting a server without Bukkit or Plug-ins so I guess I needed it this way.
i7 Sandy
(8 items)
 
Skylake Pentium
(8 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K ASRock Z75 Pro3 GTX 970 16GB 
Hard DriveOSMonitorPower
250GB Samsung 850 Evo WinXP Pro / Win7 Pro 1080p 60Hz Thermaltake Smart M850W 
CPUMotherboardGraphicsRAM
Pentium G4400 ASRock H110M-HDV GTX 550 Ti 8GB (2x4) 
Hard DriveOSPowerOther
250GB SSD Windows 7 500W 300Mbps WLAN 
  hide details  
Reply
i7 Sandy
(8 items)
 
Skylake Pentium
(8 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K ASRock Z75 Pro3 GTX 970 16GB 
Hard DriveOSMonitorPower
250GB Samsung 850 Evo WinXP Pro / Win7 Pro 1080p 60Hz Thermaltake Smart M850W 
CPUMotherboardGraphicsRAM
Pentium G4400 ASRock H110M-HDV GTX 550 Ti 8GB (2x4) 
Hard DriveOSPowerOther
250GB SSD Windows 7 500W 300Mbps WLAN 
  hide details  
Reply
post #9 of 9
Also a batch script is easier to setup / customize imo
    
CPUMotherboardGraphicsGraphics
FX-8350 Asus Crosshair V MSI GTX460 Hawk 1gb MSI GTX460 Hawk 1gb 
RAMHard DriveHard DriveHard Drive
Kingston HyperX 8gb (2x4gb) Crucial M4 64GB Samsung F3 1TB Western Digital 320GB 
CoolingOSMonitorMonitor
Custom WC Windows 7 Ultimate X64 Dell E2311H Dell E2311H 
MonitorKeyboardPowerCase
LH 23EN43 Ducky Year of the Dragon 2012 SilverStone Strider 1000W-P Corsair 800D 
Audio
Asus Xonar Essence STX 
  hide details  
Reply
    
CPUMotherboardGraphicsGraphics
FX-8350 Asus Crosshair V MSI GTX460 Hawk 1gb MSI GTX460 Hawk 1gb 
RAMHard DriveHard DriveHard Drive
Kingston HyperX 8gb (2x4gb) Crucial M4 64GB Samsung F3 1TB Western Digital 320GB 
CoolingOSMonitorMonitor
Custom WC Windows 7 Ultimate X64 Dell E2311H Dell E2311H 
MonitorKeyboardPowerCase
LH 23EN43 Ducky Year of the Dragon 2012 SilverStone Strider 1000W-P Corsair 800D 
Audio
Asus Xonar Essence STX 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › How do I make a .BAT script to copy the contents of one folder to another?