Forum Groups
  All forums
    Help & Feedback
      Work in progress
      Finished Art
      Non-Max related

Maxunderground news unavailable

Batch File to copy and paste folder contents incrementally?
show user profile  FX
I thought this would be easier :/

I just want to copy one folder with contents to another incrementally using a bat file.

C:\this folder\copyme\

C:\that folder\copyme_001\
C:\that folder\copyme_002\
C:\that folder\copyme_003\


I lack sleep and patience, could anyone help before I kill the fucking internet.

read 425 times
3/3/2017 4:58:55 PM (last edit: 3/3/2017 4:58:55 PM)
show user profile  FX're all useless.
read 400 times
3/5/2017 2:05:30 AM (last edit: 3/5/2017 2:05:30 AM)
show user profile  TiMoN
What do you mean by incrementally.. That normally signifies changes since last backup, but why put that in a new folder ?

If you just want each backup to create a new folder, then just add %Date% to the name of the destination folder.

otherwise, robocopy /mir is the easiest way of creating a backup, that only copies changes since last backup.. It will not create a new destination folder by default though..

Terribly boring signature.
read 386 times
3/5/2017 10:10:10 AM (last edit: 3/5/2017 10:10:10 AM)
show user profile  Nik Clark

Does this page help?

read 385 times
3/5/2017 10:18:54 AM (last edit: 3/5/2017 10:18:54 AM)
show user profile  FX
No it makes things worse.
read 379 times
3/5/2017 4:50:19 PM (last edit: 3/5/2017 4:50:19 PM)
show user profile  FX
Guys thanks anyway, It's cool, I'll do it manually.

Searching for .bat solutions always go this way, I just want code I can easily manipulate by changing the appropriate parameters, a ready to go script where I just change folder names and paths without needing a phd in coding.
read 372 times
3/6/2017 3:17:09 AM (last edit: 3/6/2017 3:17:09 AM)
show user profile  c0
Hold my beer...

Make sure your USB HDD is using drive letter [F:], or alternatively update the script. Simply make it [C:] if you want to use the internal HDD.

Create a file called "copystuff.cmd" or similar containing:


@echo off

set usb=F:

set mydate=%date:/=%
set mytime=%time::=%
set mytimestamp=%mydate: =_%_%mytime:.=_%

set dest=%usb%\Backup\%mytimestamp%
set switches=/E /NP /NFL /tee /R:1 /W:1 /MIR /COPYALL
set robocopy=%windir%\system32\robocopy.exe

if not exist "%usb%" exit
if not exist "%dest%" md "%dest%"

"%robocopy%" "c:\folder1" "%dest%\folder1" %switches% /LOG:"%dest%\backup_folder1.log"
:: If you have more than one folder:
::"%robocopy%" "c:\folder2" "%dest%\folder2" %switches% /LOG:"%dest%\backup_folder2.log"
::"%robocopy%" "c:\folder3" "%dest%\folder3" %switches% /LOG:"%dest%\backup_folder3.log"



Simply use "set dest=%usb%\Backup\" if you don't want to auto-increment the destination folder name each time the script is run.

If you don't need to auto-increment destination folder names I strongly recommend simply using 'FreeFileSync' however:

read 345 times
3/9/2017 12:52:54 PM (last edit: 3/9/2017 1:47:56 PM)
show user profile  FX
Wow, I'll buy you a fecking keg of beer for this, it's perfect, simple and genius, I can use this for so many small backup tasks, I'm going to spread this like herpes, what credits do you want?

many thanks.
read 318 times
3/10/2017 4:45:18 AM (last edit: 3/10/2017 4:45:18 AM)
#Maxforums IRC
Open chat window