Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Rec($path){
- if($path[-1] -eq '/' -or $path[-1] -eq '\'){
- $path += '**'
- }
- $rec = $path -split '**', 0, 'simplematch'
- if($rec.length -gt 1){ #recursive
- dir -r $rec[0] | ?{ !($_.PSIsContainer) -and ($_.FullName -like ($rec -join '*')) } | %{ $_.FullName }
- } else { #non-recursive
- dir $rec[0] | ?{ !$_.PSIsContainer } | %{ $_.FullName }
- }
- }
- Rec("C:\test\**\sub2\*.sml")
- #C:\test\sub0\sub3\sub2\set.sml
- #C:\test\sub0\sub3\sub2\vector3.sml
- #C:\test\sub1\sub2\set.sml
- #C:\test\sub1\sub2\vector3.sml
Advertisement
Add Comment
Please, Sign In to add comment