modified: RdzeN-Profile.ps1
new file: functions/Get-FileSize new file: functions/Get-FileSize copy modified: functions/prompt.ps1
This commit is contained in:
parent
7255f0ae26
commit
57cfb986dc
@ -48,10 +48,11 @@ Get-ChildItem $path_gitea_powershell_profile_functions | ForEach-Object {
|
||||
# 4. list functions
|
||||
$functions = Get-ChildItem $path_gitea_powershell_profile_functions | Sort-Object
|
||||
for ($i = 0; $i -lt $functions.Count; $i++) {
|
||||
Write-Host "$i)`t$(($functions[$i].Name).Replace('.ps1',''))"
|
||||
Write-Host "$i" -NoNewline -ForegroundColor Cyan
|
||||
write-host ")`t" -NoNewline -ForegroundColor Blue
|
||||
write-host "$(($functions[$i].Name).Replace('.ps1',''))" -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
|
||||
# 97. Override profile
|
||||
Override-Profile
|
||||
|
||||
|
23
functions/Get-FileSize
Normal file
23
functions/Get-FileSize
Normal file
@ -0,0 +1,23 @@
|
||||
# gitea.RdzeN.net
|
||||
#
|
||||
# Get filesize.
|
||||
|
||||
function Get-FileSize {
|
||||
param (
|
||||
[string]$FilePath
|
||||
)
|
||||
|
||||
$fileInfo = Get-Item $FilePath
|
||||
$fileSizeBytes = $fileInfo.Length
|
||||
|
||||
$fileSizeKB = [math]::Round($fileSizeBytes / 1KB, 2)
|
||||
$fileSizeMB = [math]::Round($fileSizeBytes / 1MB, 2)
|
||||
$fileSizeGB = [math]::Round($fileSizeBytes / 1GB, 2)
|
||||
|
||||
return @{
|
||||
"Bytes" = $fileSizeBytes
|
||||
"KB" = $fileSizeKB
|
||||
"MB" = $fileSizeMB
|
||||
"GB" = $fileSizeGB
|
||||
}
|
||||
}
|
21
functions/Get-FileSize copy
Normal file
21
functions/Get-FileSize copy
Normal file
@ -0,0 +1,21 @@
|
||||
# gitea.RdzeN.net
|
||||
#
|
||||
# Get Object Count.
|
||||
|
||||
function Get-ObjectCount {
|
||||
param (
|
||||
[string]$Path,
|
||||
[switch]$Recurse
|
||||
)
|
||||
|
||||
$items = Get-ChildItem $Path -Recurse:$Recurse
|
||||
$count = $items.Count
|
||||
|
||||
return $count
|
||||
}
|
||||
|
||||
if ($Recurse) {
|
||||
Write-Host "Liczba obiektów w katalogu '$folderPath' i podkatalogach: $objectCount"
|
||||
} else {
|
||||
Write-Host "Liczba obiektów w katalogu '$folderPath': $objectCount"
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
# gitea.RdzeN.net
|
||||
#
|
||||
# custom prompt for PS.
|
||||
function prompt
|
||||
{
|
||||
Write-Host "[" -NoNewline -ForegroundColor Blue
|
||||
@ -15,7 +18,7 @@ function prompt
|
||||
Write-Host "]" -NoNewline -ForegroundColor Blue
|
||||
Write-Host " " -NoNewline -ForegroundColor Black
|
||||
Write-Host "[" -NoNewline -ForegroundColor Blue
|
||||
Write-Host "$($PWD)" -NoNewline -ForegroundColor Cyan
|
||||
Write-Host "$($PWD.ProviderPath)" -NoNewline -ForegroundColor Cyan
|
||||
Write-Host "]" -NoNewline -ForegroundColor Blue
|
||||
Write-Host ""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user