Twitter Feed

    Windows xcopy batch script

    I wrote a small script to copy files from one drive (C:) to the destination (Z:) using a nightly cron:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    @echo off
    :: variables
    set drive=Z:\
    set backupcmd=xcopy /s /c /d /e /h /i /r /y
    echo ### BACKUP...
    %backupcmd% "C:\[SOURCE]" "%drive%"
    :: If you want to exclude certain file types add this ... /Exclude:C:\bat\exclude.txt
    :: use below syntax to backup other directories...
    :: %backupcmd% "...source directory..." "%drive%\...destination dir..."
    echo Backup Complete!

    Leave a comment