#exporting file'path' from drive >path exist limit
get-childitem 'D:\TestingFolder'
-recurse -force
| where-object
{
$_.FullName.Length -ge 256 } | select-object FullName
| export-csv
-notypeinformation -path
Drivefiles.txt |
% {$_.Replace('"','')}
#exporting file'path' from drive
get-childitem 'D:\TestingFolder'
-Recurse | where {
!$_.PSIsContainer} |
select-object FullName, @{N='FriendlySize';E={Get-FriendlySize
-Bytes $_.Length}} |Sort-Object -Property
FriendlySize | export-csv -notypeinformation -path
Drivefiles.csv |
% {$_.Replace('"','')}
function Get-FriendlySize
{
param($Bytes)
$sizes='Bytes,KB,MB,GB,TB,PB,EB,ZB'
-split ','
for($i=0; ($Bytes -ge 1kb) -and
($i
-lt $sizes.Count); $i++) {$Bytes/=1kb}
$N=2; if($i -eq 0) {$N=0}
"{0:N$($N)} {1}"
-f $Bytes, $sizes[$i]
}
No comments:
Post a Comment