Skip to content

Instantly share code, notes, and snippets.

@solarce
Created June 10, 2009 16:17
Show Gist options
  • Save solarce/127318 to your computer and use it in GitHub Desktop.
Save solarce/127318 to your computer and use it in GitHub Desktop.
echo off
rem %1 - path %2- mask %3 - archive name %4 - days old
if "%~1"=="" goto usage
if "%~3"=="" goto usage
forfiles /p "%~1" /m "%~2" /d -%~4 /c "cmd /c echo @file @fdate @ftime & 7za a %~3.7z @file && del /f /q @file"
goto quit
:usage
echo pack all files in path %%1 by mask %%2 with %%4 days old
echo to archive %%3.zip (for dated archive name use %%date:~8,2%%%%date:~3,2%%%%date:~0,2%%)
:quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment