forfiles
Select one or more files to execute a specified command on. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/forfiles.
-
Search for files in the current directory:
forfiles
-
Search for files in a specific directory:
forfiles /p {{path\to\directory}}
-
Run the specified command for each file:
forfiles /c "{{command}}"
-
Search for files using a specific glob mask:
forfiles /m {{glob_pattern}}
-
Search for files recursively:
forfiles /s
-
Search for files older than 5 days:
forfiles /d +{{5}}
License and Disclaimer
The content on this page is copyright © 2014—present the tldr-pages team and contributors.This page is used with permission under Creative Commons Attribution 4.0 International License.
While we do attempt to make sure content is accurate, there isn't a warranty of any kind.