Search code examples
windowslistcommandprompt

Command Prompt: dir file whose File size is greater than 1024KB


I am currently using the following command to find out how many documents with pdf format is there with there complete path but it shows the list of like 11,000 documents,

dir *.pdf /s /b**

I'd like to list only those images that has the file size greater than 1024KB , the file size shouldn't be displayed yet the file should be greater than 1024KB in size.

is that possible using command prompt ?


Solution

  • Since you're using windows, you will most likely have powershell:

    ls *.pdf | where-object {$_.length -gt 1048576} | format-table -property Name
    

    ls will list the files with .pdf extensions. where-object will filter the result set to files with length greater than 1MB (1048576 = 1MB). format-table will format the final output to display only the name of the file