How to delete files older than 30 days with robocopy?
82
I don't know how to do it with robocopy, but when I wanted to do the same as what you're doing, I put this line in my batch file:
forfiles -p %_BACKUPPATH% -m *.rar -d -3 -c "cmd /c del @path"
A dissection is:
forfiles
- The program for filtering the files-p %_BACKUPPATH%
--p
indicates "path" (mine is%_BACKUPPATH%
but you can replace this with a "real" path), otherwise it uses the current directory-m *.rar
- filter by filetype.rar
, skip this parameter for*.*
-d -3
- Only affect files older than 3 days (-3
)-c "cmd /c del @path"
- anything after the-c
is what will be executed for each file it finds, in this case,del
.
Related videos on Youtube
Author by
Rıfat Erdem Sahin
Updated on September 18, 2022Comments
-
Rıfat Erdem Sahin over 1 year
We are considering to use the elastic search. But we could not decide if we should use nested objects or plain objects. What are the pros and cons ?
We have highly schema changed datasource.(hourly)
-
Julio Guerra almost 13 yearsGood to know, but I will delete any file older than 3 days. This in not exactly what I want, I just want to delete files deleted in the src folder since n days.
-
MrGigu almost 13 years@Julio - and I take it the
/mir
switch isn't doing this for you? -
Julio Guerra almost 13 yearsNo. I synced a new file file first, then I deleted it in the src folder and I ran the previous command with /mir and /minage:30 expecting a "delete files older than 30 days" behavior but it does not.
-
Rıfat Erdem Sahin over 9 yearsif objects are nested it means there are multiple queries to retrieve that object right ?
-
Jettro Coenradie over 9 yearsNo not really, you can do a nested query to obtain the document. You cannot get back the nested object, only the document containing the nested object. Maybe you mean the parent-child structure also available in elasticsearch
-
Rıfat Erdem Sahin over 9 yearsI need an adaptive system and I also need it fast.