I'm trying to use get-childitem to search all directories with name like "temp","temp2","temp3"....
How can I assume to use wildcard to search directories names? Thanks all.
I'm trying to use get-childitem to search all directories with name like "temp","temp2","temp3"....
How can I assume to use wildcard to search directories names? Thanks all.
I tried gci -filter _comp* -Recurse
and it works, returning all matching folders and files, of course you can omit the -Recurse
switch to just get the matching folders and files in the current folder.
If you want to return all files (regardless of matching name) contained in those matching folders then you'll need to pipe to output to ForEach-Object and do some magic there.