snippetbashTip
forfiles — Select files to execute a specified command on. More information: <https://learn.microsoft.com/windo
Viewed 0 times
selectcommandfilesexecuteforfilesclispecified
windows
Problem
How to use the
forfiles command: Select files to execute a specified command on. More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/forfiles>.Solution
forfiles — Select 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:
forfilesSearch 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 /sSearch for files older than 5 days:
forfiles /d +{{5}}Code Snippets
Search for files in the current directory
forfilesSearch 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 /sContext
tldr-pages: windows/forfiles
Revisions (0)
No revisions yet.