Home > PowerShell > Find the filesize using PowerShell

Find the filesize using PowerShell

Below piece of code helps to find the size of a file that you mention. This code can find the size of a local file, or a file on remote system. You need to give the full path of file to make it work.

$filepath="YOUR FILE PATH"
Get-ChildItem $filepath | ForEach-Object { Write-Host $_.name,==> ($_.Length/1MB).tostring("0.00")MB
Categories: PowerShell
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>