Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List files with path and file size only in Command Line

Tags:

People also ask

How do you list files and folders with respective size?

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