Microsoft‎ > ‎Windows‎ > ‎Commands‎ > ‎

Zip specific file types in a folder and automatically insert date in file name

Create a batch file and schedule it to be run in task scheduler.
Batch file should look like this:
_________________________________________________________________________________________________

@For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @(
    Set Month=%%A
    Set Day=%%B
    Set Year=%%C
)

@echo DAY = %Day%
@echo Month = %Month%
@echo Year = %Year%


C:\_batch\7za.exe a -t7z D:\NightlySQLBackups\Full\SQLDBNAME_backup_%Year%%Month%%Day%1200.7z D:\NightlySQLBackups\FullSQLDBNAME*.bak

Comments