To list all files and sort them by size, use the -S option. By default, it displays output in descending order (biggest to smallest in size). You can output the file sizes in human-readable format by adding the -h option as shown. And to sort in reverse order, add the -r flag as follows.
Windows Command Line (or maybe PowerShell).
How can I list all files, recursively, with full path and filesize, but without anything else and export to a .txt file. Much preferably a code that works for whichever current directory I am in with the Command Line (so does not require manual entering of the target directory).
None of these provides path\filename and filesize only:
dir /s > filelist.txt
dir /s/b > filelist.txt
dir /s/o:-d > filelist.txt
Desired output (fullpath\file.ext filesize):
c:\aaa\file.ext 7755777
c:\aaa\bbb\1.txt 897667
c:\aaa\bbb\2.ext 67788990
c:\aaa\bbb\nnn\a.xls 99879000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With