0

MY folder structure on mac is as below Folder-1 testfile.txt 12 kb subfolder file2 14 kb file3 10 mb Folder -2 subfolder-1 testfile 13 kb subfolder 1.1 textfile.txt 10 kb pdffile. file 32 kb I want a command to display path ,filename and size of the file in ascending order . expectation : ./Folder-1 /subfolder /file3 10 mb ./Folder -2/subfolder-1/subfolder1.1/pdffile.pdf 32 kb.

I found this for /r %i in (*) do @echo %i" on windows to fetch the files with path ,but along with path i need file size in ascending order in mac.

Please refer attachmententer image description here.

Your Inputs are well appreciated!! Thanks

0

1 Answer 1

0

You can use the ducommand by using :

$ du -ah myFolder

This was mentioned here: https://unix.stackexchange.com/questions/88065/sorting-files-according-to-size-recursively

If you really need to filter out folders and keep files only, you can use find to take the list of files and pipe the output to sort command:

$ find . -type f -exec du -a {} + | sort -n -r

source: https://unix.stackexchange.com/a/22448

You must log in to answer this question.

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