Question
September 27, 2007 at 06:48 AM
bkatzman

Backup batch file to overwrite older ones…

by bkatzman . Updated 19 years, 1 month ago

So I thought I was brilliant when I adapted a batch file that I saw on the Internets, but now I want to adapt this one to update old folders, instead of just creating new one.
For example, if I ran the batch file it would either get rid of the old one and create a new one or update the old one and include’s today’s date. Here is “my” snazzy batch file:

@echo off
REM – Must be run under the profile that you would like to backup
:: variables
set Pdate=%date:~4,2%_%date:~7,2%_%date:~10,4%
ECHO %Pdate%
set drive=\\NAFTA_server\home\dcheney\my docs %Pdate%
set backupcmd=xcopy /s /c /d /e /h /i /r /y

echo ### Backing up My Documents…
%backupcmd% “%USERPROFILE%\My Documents” “%drive%\My Documents”

echo ### Backing up Desktop…
%backupcmd% “%USERPROFILE%\Desktop” “%drive%\Desktop”

echo ### Backing up Favorites…
%backupcmd% “%USERPROFILE%\Favorites” “%drive%\Favorites”

This discussion is locked

All Comments