Page 1 of 1

MacOS – How to find large files from Terminal recursively

MacOS – How to find large files from Terminal recursively

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
Examples: "MacOS X - Your question", "MS Word - Your Tip or Trick".

Please note that switching to another language when reading a post will not work!
Posts will not have a translated counterpart.




RSS Feed

Home Forums Software MacOS X Software MacOS – How to find large files from Terminal recursively

This topic contains 1 reply, has 1 voice, and was last updated by  hans 5 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • 11619

    hans
    Keymaster

    Since I had to clean up my NAS, I had to go find the largests file on a particular directory and its sub-directories.
    There are some tools for that, but they either do not work on a network share (Spotlight) or they spit out directories as well (du).

    So after some searching and tinkering I came up with this:

    sudo find -x <directory> -type f -size +<size>

    Where <directory> can be any path, and size is done in the format: 1G (for > 1Gb), 2G, etc.
    So as an example, find all files larger than 4Gb (mind you: it is the 1024 kind!) on /Volumes/MyNASShare

    sudo find -x /Volumes/MyNASShare -type f -size +4G

    Hope it is of use to someone 

    11625

    hans
    Keymaster

    Little addon to this; say you want to find files bigger than 4 Gb and older than 7 days, we can use the same format and add “-mtime +7”, like so:

    sudo find -x /Directory/To/Search/ -type f -size +4G -mtime +7
Viewing 2 posts - 1 through 2 (of 2 total)



You must be logged in to reply to this topic.