Skip to content

cd-public

Sets the working dir to the Public folder

#requires -version 5.1

try {
	if ($IsLinux) {
		if (-not(Test-Path "~/Public" -pathType container)) {
			throw "No 'Public' folder in your home directory yet"
		}
		$path = Resolve-Path "~/Public"
	} else {
		if (-not(Test-Path "~/../Public" -pathType container)) {
			throw "No 'Public' folder yet"
		}
		$path = Resolve-Path "~/../Public"
	}
	Set-Location "$path"
	$files = Get-ChildItem $path -attributes !Directory
	$folders = Get-ChildItem $path -attributes Directory
	"📂$path entered (has $($files.Count) files and $($folders.Count) folders)"
	exit 0
} catch {
throw
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.