Friday, May 8, 2015

How to delete files older than 30 days with one command line.


cleanup.bat

forfiles /p e:\camfiles /d -30 /m *.* /s /c "cmd /C del /q @FILE"

IP cameras do an ftp upload every five minutes. A schedules task will clean up the old files nightly.

Monday, February 9, 2015

Simple script to backup Fortinet hardware.


I have a bunch of Fortinet equipment installed and I needed an easy way to backup my configurations. This is a windows command line script that requires putty and an ftp server. When a new unit is installed, just add one line to this script.


bkup.bat

echo execute backup config ftp  /unit-123 ftp.example.com  user pass >bkup.tmp
c:\putty 10.123.1.1 -l admin -pw pass -m bkup.tmp

echo execute backup config ftp  /unit-124 ftp.example.com  user pass >bkup.tmp
c:\putty 10.124.1.1 -l admin -pw pass -m bkup.tmp

...