blob: 27355c2cb0e076f0fe5176056046f392690db53c (
plain)
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
|
# Hide all dotfiles and git-ignored files before build
# Set working directory to parent of script's directory
Set-Location -Path (Join-Path $PSScriptRoot "..")
# First, unhide all files and directories in the current directory, but skip .temp and .git directories
Get-ChildItem -Path . -Force -Recurse -ErrorAction SilentlyContinue | Where-Object {
$_.FullName -notmatch '\\.temp\\' -and $_.FullName -notmatch '\\.git\\'
} | ForEach-Object {
attrib -h $_.FullName 2>&1 | Out-Null
}
# Get all dotfiles and directories
Get-ChildItem -Path . -Force -Recurse -ErrorAction SilentlyContinue | Where-Object {
$_.Name -match '^\..*' -and $_.FullName -notmatch '\\\.\.$' -and $_.FullName -notmatch '\\\.$'
} | ForEach-Object {
attrib +h $_.FullName 2>&1 | Out-Null
}
# Get git ignored files and hide them
if (Get-Command git -ErrorAction SilentlyContinue) {
git status --ignored --short | ForEach-Object {
if ($_ -match '^!!\s+(.+)$') {
$ignoredPath = $matches[1]
if (Test-Path $ignoredPath) {
attrib +h $ignoredPath 2>&1 | Out-Null
}
}
}
}
|