Hi experts..
I running the below script everyday using task scheduler to backup the database locally , and save along with the current date and time.
I need your help how to enhance little bit to rotate the backup copy, keep the latest copy and delete the previous copies.
set PGPASSWORD=password123
@echo off
set datetime=%date:~-4%_%date:~-7,2%_%date:~-10,2%_%time:~0,2%_%time:~3,2%_%time:~6,2%
echo %datetime%
"D:\Program Files\VASCO\PostgreSQL\bin\pg_dump" -f "D:\Program Files\VASCO\IAS-Backup\DB_BK\PRI_AUTH_DB_BAK_%datetime%.bak" -Fc -Z9 -U username -v databaseinstance
please help me.