3

I am currently running a batch file that backs up all my files created or modified within the past 24 hours using an old version of Winzip. I use 7 zip for a lot of archiving and would like to be able to use it for this purpose but it does not have switches that let you select files based on their date/time stamp. I do NOT want to copy files to a directory based on their time stamp and archive them form there. Any suggestions?

3 Answers 3

4

http://ss64.com/nt/forfiles.html

and

http://www.dotnetperls.com/7-zip-examples ->

 forfiles  /c "7za a -t7z @fname.7z @file" /d -1
1
  • 2
    Mind expanding these links? Link only answers may be deleted.
    – soandos
    Jul 15, 2012 at 18:19
1

Wth some research I came up with something that should work...

forfiles  /c "cmd /c 7z u -t7z [setup an empty 7z file].7z @path" /d -1 /s
0

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"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .