Posted on 10-20-2022 12:15 PM
I'm looking to get some insight into large files and folders on computers before they get to our office. We are seeing a large number of requests come in for not being able to update their macOS dues to low available storage so I'd like to be able to get a report on who has what storage left, easily looking into a device record and see the top 5 or 10 large files and folders. I've been playing with the "du" and "find" commands but struggling to put it together in a useable format for a script or extensions attribute. Does anyone have anything?
Posted on 10-21-2022 05:40 AM
Nope, not yet.
Posted on 10-21-2022 08:53 AM
what I am using seems to work for us, ymmv. As always test:
#!/bin/sh
LOGGEDIN=`ls -l /dev/console | awk '/ / { print $3 }'`
LARGEFILE=`sudo find /Users/$LOGGEDIN -type f -size +1G`
echo "<result>$LARGEFILE</result>"
Posted on 10-21-2022 10:04 AM
Thanks will play with this today. Did you consider searching the whole HD as opposed to the logged in user folder, and did you work on adding the actual file size to the list?
Posted on 10-21-2022 12:40 PM
I did add the size to each with below, now playing with searching the whole HD as opposed to just the user folder
#!/bin/sh
LOGGEDIN=`ls -l /dev/console | awk '/ / { print $3 }'`
LARGEFILE=`sudo find /Users/$LOGGEDIN -type f -size +5G -exec du -hs {} \; | sort -hr`
echo "<RESULTS>$LARGEFILE</RESULTS>"
Posted on 10-24-2022 04:45 PM
Hey @TomDay ,
that is what I was going to recommend, got busy prepping for Ventura, good start sir