Page 1 of 1

DEL oldfiles

Posted: 12 Feb 2023 19:16
by xiro
Guys I just want to ask how you delete files older than 14 days or three days or set a number of days for the file to be deleted because Del command has only the following attributes?


Image



any ideas, suggestions?

Re: DEL oldfiles

Posted: 13 Feb 2023 00:36
by ShadowThief
That's what the forfiles command is for.

Code: Select all

forfiles /p "C:\what\ever" /s /m *.* /D -<number of days> /C "cmd /c del @path"
See https://stackoverflow.com/questions/510 ... han-n-days for more examples.

Re: DEL oldfiles

Posted: 13 Feb 2023 03:09
by xiro
ShadowThief wrote:
13 Feb 2023 00:36
That's what the forfiles command is for.

Code: Select all

forfiles /p "C:\what\ever" /s /m *.* /D -<number of days> /C "cmd /c del @path"
See https://stackoverflow.com/questions/510 ... han-n-days for more examples.
Ah so that the reason why no del attribute for for a specific date of file to be deleted. Any way to make forfiles faster?

Re: DEL oldfiles

Posted: 13 Feb 2023 19:09
by ShadowThief
Delete fewer files?

Re: DEL oldfiles

Posted: 13 Feb 2023 19:43
by xiro
xiro wrote:
13 Feb 2023 03:09
ShadowThief wrote:
13 Feb 2023 00:36
That's what the forfiles command is for.

Code: Select all

forfiles /p "C:\what\ever" /s /m *.* /D -<number of days> /C "cmd /c del @path"
See https://stackoverflow.com/questions/510 ... han-n-days for more examples.
Ah so that the reason why no del attribute for a specific date of file to be deleted. Any way to make forfiles faster?
Thank you so much for the forfiles command that you share but is their a way or other command or attribute to make the deletion faster I am deleting multiple folders a lot of time and they are sized up to 60 GB or more aside from doing it manually any other way forfiles is fast for individual items but with folders containing multiple files with the large size the delete process took more than overnight for I have tested this.

I hope anyone here tried another alternative :?:

Re: DEL oldfiles

Posted: 13 Feb 2023 19:44
by xiro
ShadowThief wrote:
13 Feb 2023 19:09
Delete fewer files?
Need to delete it on bulk so the next day the external hdd is available for another set of backup :)

Re: DEL oldfiles

Posted: 13 Feb 2023 21:22
by ShadowThief
Would it be faster to move all the files that are younger than 3 days old somewhere else and then delete the folders entirely?

Barring that, BestBuy is currently selling 18 TB external hard drives for $290, which is cheaper than they're usually going for. It may be worth upgrading your storage so that you have more time to let the command run.

Re: DEL oldfiles

Posted: 14 Feb 2023 19:29
by xiro
ShadowThief wrote:
13 Feb 2023 21:22
Would it be faster to move all the files that are younger than 3 days old somewhere else and then delete the folders entirely?

Barring that, BestBuy is currently selling 18 TB external hard drives for $290, which is cheaper than they're usually going for. It may be worth upgrading your storage so that you have more time to let the command run.
if move that's robocopy right with the attribute /maxage:3 right? I prefer to delete so I was really looking for an option or workaround for this but thank for your suggestions anyway :)

Re: DEL oldfiles

Posted: 08 Apr 2023 14:20
by ohenryx2
This is one of those situations where I would use the unix like tools found in Cygwin. There is an excellent discussion of this exact topic "How to find and delete files older than specific days in unix?" at

https://unix.stackexchange.com/question ... ys-in-unix

Re: DEL oldfiles

Posted: 24 Apr 2023 16:06
by DOSadnie
How about using Everything?

It will probably allow for filtering of files based on some regular expression or some inner feature which could be saved thus accessed with just ~3 clicks later on

And on top of an AutoHotkey file would serve as a script doing this automatically - and also make it run one way or another on system startup

Re: DEL oldfiles

Posted: 25 Apr 2023 01:02
by koko
There's a utility called byenow from the dev of Bvckup that is faster (some bechmarks of byenow/del/rmdir/robocopy appear on the page). May want to test it.

Edit: forgot it takes directories as inputs only.

Image