Forfiles Windows 10

Posted By admin On 12/01/22
Active11 months ago
  1. Windows 10 Download
  2. Icons For Files Windows 10

I'm looking to automatically delete files older than 7 days old with forfiles.


The code below works when I do it manually and respond yes to deleting the files. How can I incorporate the yes into this?

This is the output:

Forfiles Forfiles is a useful windows command to select a set of files and then run a command on each of the files. It’s similar to the functionality of find command on Linux OS. The syntax of the forfiles is as follows.


I’ve followed your guide on how to delete files older than X days automatically on Windows 10, but the problem is that I can’t get it to work on our company’s shared drive. I am an IT and have full rights to that drive. Windows 10 screen capture produces files all with the same name, appending a serial number. Capture.exe produces a.bmp file with the date/time in the file name. I wish to do this. I've investigated the FOR and FORFILES CMDs, but so far no success. This code will get the system date:-:: Get the date/time. What is the exact version of Windows 10? Open run window with Win+R. Now type winver + Enter. Then post a screnshot of the result or copy it in your next answer. 1- Right click on Start Button, then select 'Windows PowerShell (admin)' or 'Command Prompt (admin)' 2- Now repair any damage in the system files, by running this commmand sfc /scannow. Aug 21, 2018  Windows Commands topic for. With forfiles, you can run a command on or pass arguments to multiple files.For example, you could run the type command on all files in a tree with the.txt file name extension. Or you could execute every batch file (.bat) on drive C, with the file name 'Myinput.txt' as the first argument.

42.2k8 gold badges107 silver badges139 bronze badges
2762 gold badges5 silver badges15 bronze badges

3 Answers

Windows 10 Download

You could try adding in a /Q /S, though be aware that this may not in fact do what you really want it to:

You are probably better off either using CSCRIPT (with your choice of VBScript or JScript) or PowerShell. Check out this answer from StackOverflow:

Here is some vbscript to accomplish a similar task:

GoyuixGoyuixForfiles Windows 10
5,5613 gold badges31 silver badges47 bronze badges

This example removes all files in the folder 'G:db_bk_copies' older than 3 days without asking the users to confirm deletion (Are you sure (Y/N)?):

forfiles -p 'G:db_bk_copies' -s -m * /D -3 /C 'cmd /c del /a-s @path'

2,5001 gold badge16 silver badges33 bronze badges

Icons For Files Windows 10

Ahmed GenediAhmed Genedi

Verify that the files are not Hidden or system files.

If System try:

If Hidden Try:

115k27 gold badges255 silver badges285 bronze badges

Not the answer you're looking for? Browse other questions tagged windowscommand-linescriptbatch or ask your own question.