You are on page 1of 1

Close but will archive files older than one day with those switches here is the

syntax for current day (with a date added to the output file :

set hr=%time:~0,2%
if "%hr:~0,1%" equ " " set hr=0%hr:~1,1%

Rem - compress data that is from current day

forfiles /p "c:\<path of what to backup>" /d 0 /c "cmd /c C:\<Location of 7zip>\7za


u -tzip D:\<Where you want archive saved>\Archive_%date:~-4,4%%date:~-10,2%%date:~-
7,2%_%hr%%time:~3,2%%time:~6,2%.zip @PATH -mmt"

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

set hr=%time:~0,2%
if "%hr:~0,1%" equ " " set hr=0%hr:~1,1%

Rem - compress data that from 30 last days

forfiles /p c:\users\users\FAVORITES /d +30 /c "cmd /c C:\Program Files\7-zip\7z u


-tzip C:\USERS\USER\DOWNLOADS\__PROVA\Archive_%date:~-4,4%%date:~-10,2%%date:~-
7,2%_%hr%%time:~3,2%%time:~6,2%.zip @PATH -mmt"

You might also like