Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to monitor a folder in windows Server. This folder gets updated every time. I need to get the size of the file and file name inside this folder - Just by running a script.

share|improve this question
up vote 1 down vote accepted

You can do this from the command line like this:

for %I in (test.jpg) do @echo %~zI

You can also pass in a file mask to get a listing for more than one file:

for %I in (*.doc) do @echo %~znI

Will display the size, file name of each .DOC file.

Use below line to display size of all the files as well as file name inside a directory.

for %I in (*) do @echo %~znI
share|improve this answer

If sub-folders do not need it, command-line:

dir "<folder path>" /A:-D
share|improve this answer

You can also use



you retive all files in the directory with the following attributes:

Mode                LastWriteTime     Length Name

If you need only the filename and the size you can use

Get-ChildItem | Format-Table Name,Length
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .