Reputation: 425
how to get a list of particular file type in a folder and sub folders in Linux and sort by file size
This is what i tried
find . -type f -name "*xml" | sort -r -n
It did not sort the files based on size
Upvotes: 0
Views: 121
Reputation: 5805
you can print the top 50 this way:
find . -type f -iname "*xml" -exec du {} + | sort -rn | head -n50
obviously drop the head
if you want all of them
find . -iname "*txt" -exec du {} + | sort -rn
Upvotes: 1