Wednesday, May 8, 2024
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 2254  / 1 Year ago, fri, december 30, 2022, 2:53:19

I would like to find (later delete) all music folders that are nearly empty (Banshee deletes only the music files but not the other files in there).



I tried with:



find -type d -size -500k ;


But it shows folders that contain bigger files too.



find -type d -size -500k -exec du {} ;


shows the correct size.



How to modify the find cmd to only show folders that are smaller then N?


More From » command-line

 Answers
7

One command I use, as long as you don't need to pipe this straight into another script, is



du . | sort -rn



This would put the smallest folders at the bottom of the printed list along with their sizes. It would take a bit more work to filter out the ones that are larger.


[#42219] Saturday, December 31, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
donurp

Total Points: 328
Total Questions: 128
Total Answers: 123

Location: Faroe Islands
Member since Thu, Apr 8, 2021
3 Years ago
donurp questions
;