Pull from log.txt to delete file
Posted: 01 Aug 2018 09:14
So, I'm trying to make a bat file that copies data but after so many days I want it to delete folders as well. My plan is to have the script write a log giving each backup event a number that counts up 1 every time it runs then after 30 days it will delete the folder. So if the script made backup number 35 it would delete backup number 5. At the moment I have no Idea how to make a log that would count like this or would I know how to make my bat count back so many days to find the file to delete. If it helps here is the way I create my backup folder.
I do not want to have to download anything all I want is to know if it is possible to make a database type txt file that keeps counting up 1 every time a file is added and deletes 1 file after 30 other files have been added. If you know a way to avoid having to pull from my log idea please tell me.
Code: Select all
set t = %date:~4,2%-%date:~7,2%-%date:~10,4%@%time:~0,2%.%time:~3,2%
set destination = C:\OfficeBackups\%t%
echo Creating directory
mkdir %destination%