Skip to content

Commit de29c35

Browse files
author
Markus Fleschutz
committed
Updated cd-fonts.ps1, cd-pics.ps1, and cd-templates.ps1
1 parent 3d31f68 commit de29c35

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

scripts/cd-fonts.ps1

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<#
22
.SYNOPSIS
3-
Sets the working directory to the fonts folder
3+
Sets the working dir to the fonts folder
44
.DESCRIPTION
5-
This PowerShell script changes the working directory to the fonts folder.
5+
This PowerShell script sets the current working directory to the fonts folder.
66
.EXAMPLE
7-
PS> ./cd-fonts
8-
📂C:\Windows\Fonts (has 12 fonts and 0 folders)
7+
PS> ./cd-fonts.ps1
8+
📂C:\Windows\Fonts with 12 font files entered.
99
.LINK
1010
https://github.com/fleschutz/PowerShell
1111
.NOTES
@@ -19,8 +19,7 @@ try {
1919
}
2020
Set-Location "$path"
2121
$files = Get-ChildItem $path -attributes !Directory
22-
$folders = Get-ChildItem $path -attributes Directory
23-
"📂$path entered (has $($files.Count) fonts and $($folders.Count) folders)"
22+
"📂$path with $($files.Count) font files entered."
2423
exit 0 # success
2524
} catch {
2625
"⚠️ Error: $($Error[0])"

scripts/cd-pics.ps1

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<#
22
.SYNOPSIS
3-
Sets the working directory to the user's pictures folder
3+
Sets the working dir to the user's pictures folder
44
.DESCRIPTION
5-
This PowerShell script changes the working directory to the user's pictures folder.
5+
This PowerShell script sets the current working directory to the user's pictures folder.
66
.EXAMPLE
7-
PS> ./cd-pics
8-
📂C:\Users\Markus\Pictures entered (has 7 files and 0 subfolders)
7+
PS> ./cd-pics.ps1
8+
📂C:\Users\Markus\Pictures with 7 files and 0 folders entered.
99
.LINK
1010
https://github.com/fleschutz/PowerShell
1111
.NOTES
@@ -14,17 +14,20 @@
1414

1515
try {
1616
if ($IsLinux) {
17+
if (-not(Test-Path "~/Pictures" -pathType container)) {
18+
throw "No 'Pictures' folder in your home directory yet"
19+
}
1720
$path = Resolve-Path "~/Pictures"
1821
} else {
1922
$path = [Environment]::GetFolderPath('MyPictures')
20-
}
21-
if (-not(Test-Path "$path" -pathType container)) {
22-
throw "No pictures folder at $path"
23+
if (-not(Test-Path "$path" -pathType container)) {
24+
throw "No pictures folder at: $path"
25+
}
2326
}
2427
Set-Location "$path"
2528
$files = Get-ChildItem $path -attributes !Directory
2629
$folders = Get-ChildItem $path -attributes Directory
27-
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
30+
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
2831
exit 0 # success
2932
} catch {
3033
"⚠️ Error: $($Error[0])"

scripts/cd-templates.ps1

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<#
22
.SYNOPSIS
3-
Sets the working directory to the templates folder
3+
Sets the working dir to the templates folder
44
.DESCRIPTION
5-
This PowerShell script changes the working directory to the templates folder.
5+
This PowerShell script sets the current working directory to the templates folder.
66
.EXAMPLE
7-
PS> ./cd-templates
8-
📂/home/Markus/Templates entered (has 3 files and 0 subfolders)
7+
PS> ./cd-templates.ps1
8+
📂/home/Markus/Templates with 3 files and 0 folders entered.
99
.LINK
1010
https://github.com/fleschutz/PowerShell
1111
.NOTES
@@ -14,17 +14,20 @@
1414

1515
try {
1616
if ($IsLinux) {
17+
if (-not(Test-Path "~/Templates" -pathType container)) {
18+
throw "No 'Templates' folder in your home directory yet"
19+
}
1720
$path = Resolve-Path "~/Templates"
1821
} else {
1922
$path = [Environment]::GetFolderPath('Templates')
20-
}
21-
if (-not(Test-Path "$path" -pathType container)) {
22-
throw "No templates folder at $path"
23+
if (-not(Test-Path "$path" -pathType container)) {
24+
throw "No templates folder at: $path"
25+
}
2326
}
2427
Set-Location "$path"
2528
$files = Get-ChildItem $path -attributes !Directory
2629
$folders = Get-ChildItem $path -attributes Directory
27-
"📂$path entered (has $($files.Count) files and $($folders.Count) subfolders)"
30+
"📂$path with $($files.Count) files and $($folders.Count) folders entered."
2831
exit 0 # success
2932
} catch {
3033
"⚠️ Error: $($Error[0])"

0 commit comments

Comments
 (0)