Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Getting files using Get-ChildItem

$
0
0

In my free time I like to contribute to a few open source projects. In one of these projects I recently found a bug that was happening when one of our scripts was running. The entire issue pretty much boils down to his one line:

Powershell
$templatefiles+=(Get-ChildItem-Path$f.FullName-Filter_project.vstemplate.xml-Recurse-File)

What's happening is it's recursively going through each subdirectory searching for files with that name. However, we need to be able to exclude files who's parent folder is named SW-ProjectVSTemplateFile. I figured that I could somehow use the exclude attribute but I've been unable to get it to work. Is this the correct way to exclude the specific files or is there a better way?


Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>