Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography



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\

...etc

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

tia
read 337 times
3/3/2017 4:58:55 PM (last edit: 3/3/2017 4:58:55 PM)
show user profile  FX
...you're all useless.
read 312 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 298 times
3/5/2017 10:10:10 AM (last edit: 3/5/2017 10:10:10 AM)
show user profile  Nik Clark
http://stackoverflow.com/questions/13328421/how-do-i-increment-a-folder-name-using-windows-batch

Does this page help?


Click here to send me an emailClick here to visit my websiteClick here to visit my photo gallery on Flickr

read 297 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 291 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 284 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
SETLOCAL

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"

:End
ENDLOCAL
:Exit

====================

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:

http://www.freefilesync.org/faq.php#usage

read 257 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 230 times
3/10/2017 4:45:18 AM (last edit: 3/10/2017 4:45:18 AM)
#Maxforums IRC
Open chat window


Support Maxforums.org