-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGet-FilesNotInProject.ps1
More file actions
48 lines (38 loc) · 1.09 KB
/
Get-FilesNotInProject.ps1
File metadata and controls
48 lines (38 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<#
.SYNOPSIS
Find and display files in a project folder that are not included in the project.
.DESCRIPTION
Find and process files in a project folder that are not included in the project.
.PARAMETER Project
The fullname to the project file.
#>
[CmdletBinding()]
param(
[Parameter(Position=0,
Mandatory=$true,
ValueFromPipeline=$True,
ValueFromPipelineByPropertyName=$True)]
[string]$project
)
$ErrorActionPreference = "Stop"
$WorkingFolder = ".\Scripts"
$FileType = "*.cs"
$ProjectPath = Split-Path $project
$ProjectName = Split-Path $project -leaf -resolve
$ProjectFiles = & $WorkingFolder\Get-FilesIncludedInProject.ps1 $project
$DiskFiles = & $WorkingFolder\Get-FilesInProjectFolder.ps1 $project
$FileNotIncluded = compare-object $DiskFiles $ProjectFiles -PassThru
$FileNotIncluded = $FileNotIncluded | select -unique
$Array = @()
if ($FileNotIncluded)
{
ForEach($file in $FileNotIncluded)
{
if (Test-Path $file)
{
$Array += $file
}
}
$Array = $Array | select -unique
}
return $Array