dir
receives a list of patterns so you can just use multiple wildcard patterns
dir /s *plus* *vest*
You may want to use dir /b /s *plus* *vest*
instead for saner output
Or you can also filter the result with findstr
dir /b /s | findstr /i "plus vest"
findstr
will find words separated by spaces by default and will return lines that match plus
or vest
. /i
is used to match case-insensitively, you can remove it if you don't want. But this method will be much slower because all the file paths must be printed out to the pipe
Note that this will also find all files in folders named *plus*
or *vest*
. You can remove /b
but the output of dir /b /s | findstr /i "plus vest"
will very confusing because you don't know which folder a file is in
To find (plus
OR vest
) but NOT hoodie
use
dir /b /s *plus* *vest* | findstr /i /v hoodie
But that will also exclude files in folders named *hoodie*
. Again removing /b
helps but the output would be likely unhelpful. You should use PowerShell instead for such complex things. In fact I avoid writing anything new in cmd, PowerShell is significantly better, you don't have to learn the legacy quirks of cmd. In PowerShell that would be done as
Get-ChildItem -Recurse -Include "*plus*", "*vest*" | Where-Object { $_.Name -notlike "*hoodie*" }
or the shorter aliased version:
ls -R -I "*plus*", "*vest*" | where { $_.Name -notlike "*hoodie*" }