bat script to delete file older than 7 days
Posted
by Jessie
on Stack Overflow
See other posts from Stack Overflow
or by Jessie
Published on 2010-06-08T22:24:23Z
Indexed on
2010/06/08
22:32 UTC
Read the original article
Hit count: 204
hi guys i have a bat script in which gets all files in a folder and then converts this folder with its contents into a one RAR file. This script also adds the current date once it makes a copy and moves it this file into a backup folder, i am planning to have this bat file run by a windows scheduler task every day. My question is there a way to add into this cript to also delete all rar files older than 7 days in the backup folder?
for /f "delims==" %%D in ('DIR D:\scripts /A /B /S') do (
"C:\Program Files\WinRAR\WinRAR.EXE" a -agyyyy-MM-dd -r "c:\backup\scripts.rar" "%%D"
)
© Stack Overflow or respective owner