-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpfolders.ps1
More file actions
37 lines (30 loc) · 859 Bytes
/
cpfolders.ps1
File metadata and controls
37 lines (30 loc) · 859 Bytes
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
[CmdletBinding()]
param (
[Parameter()]
[string]
$path
)
# is the path empty
IF([string]::IsNullOrEmpty($path)) {
Write-Host "You must pass a value for the path to process"
return;
}
function GetSize
{
param([string]$pth)
$thesize = ((gci -path $pth -recurse | measure-object -property length -sum).sum /1kb)
"{0:n2}" -f ((gci -path $pth -recurse | measure-object -property length -sum).sum /1kb) + " kb"
}
if (Test-Path -Path $path){
Write-Output "The path is not empty"
$subFolders = Get-ChildItem -Path $path -Directory
foreach ($subfolder in $subFolders) {
Write-Output $subfolder.Fullname
}
}else {
Write-Output "Ops the path is empty"
}
Write-Output ""
Write-Output "processing compressing path: $path"
$fSize = GetSize($file)
Write-Output "The size of hte directory is $fSize "