• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is there a shell tool to find folders greater than a given size?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a shell tool to find folders greater than a given size?


  • Subject: Re: Is there a shell tool to find folders greater than a given size?
  • From: deivy petrescu <email@hidden>
  • Date: Fri, 29 Feb 2008 22:35:35 -0500


On Feb 29, 2008, at 21:46, Gary (Lists) wrote:

"Gary (Lists)" wrote:

Is there something shelly that reports back a list, with paths, of all folders
exceeding some size limit, given some start folder?

I have been working on this (AS) script that reports in HTML about folders
whose size is greater than some given size [*], in an hierarchical report.

[*]
The Finder does a fast and fine job of getting a list of big folders with the
command:


every folder of _someFolder whose physical size is greater than _someSize

The real work is just managing the list of hierarchical results, since I only
want to keep drilling down folders that exceed the limit, until there are not
any more folders that do...then I've found the folder(s) contributing the
weight.

"Mark J. Reed" wrote:

The size of a folder (beyond the physical size of its directory list)
is not readily available in the shell. Typically you use the "du"
(disk usage) command to add up how much space a folder's contents take
up. You could pipe the result through awk to find the folders whose
size exceeds your threshold value...but you'd still have the list
management problem. I think I'd stick with the Finder on this one.

Thanks, Mark. I see what you mean and I think you're right. I'll stick
with the Finder script version.


It is good to know about "du".  I figured there was some such beast.


"Peter Baxter" wrote:

Why not use AS as this is a site for such scripts?

Hi Peter.

I know this is an AS list, thanks. I think maybe you didn't read my post.

tell application "Finder"
get the name of every folder whose physical size is greater than
5.74971904E+9
end tell

Yes, I wrote that already. ;)


"demski" wrote:

Hey Gary!
I tried this out, just because I was interested, does it not do what
you wanted?

Hi Demski.

Yes, your script is generally in line with my approach (that is, looping
around and getting physical sizes.)


tell application "Finder"
set bigones to {}
set vols to {}
set bigones to get the name of every folder whose physical size is
greater than 256000
[...]

My real work, as I wrote and as Mark reiterated, is not gathering size data.
Managing that list, to prepare it in a human-useful way, is the real work.


I currently present a nice HTML report, with clickable URL links (posix
paths) to get to those 'offending' folders.


Since you're interested, I'll be sure to share the script with you.

--
Gary


Gary,

My suggestion using the shell.
I believe this list is more manageable, not much, but it could be faster.


________
set maxfoldsize to 156544  --change to your taste,
---you cam make it fairly large by making it a text
set l to every paragraph of (do shell script "du ~/Desktop |sort -n -r")
repeat with j from 1 to (count of l)
	set w1 to word 1 of item j of l
	if (0 + w1) < maxfoldsize then try
		return items 1 thru (j - 1) of l
	on error
		return {}
	end try
end repeat
________

Deivy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Re: Is there a shell tool to find folders greater than a given size? (From: "Gary (Lists)" <email@hidden>)

  • Prev by Date: Re: Is there a shell tool to find folders greater than a given size?
  • Next by Date: Re: recursive folder count
  • Previous by thread: Re: Is there a shell tool to find folders greater than a given size?
  • Next by thread: Re: Timing issues with Java executing AppleScript calling iTunes
  • Index(es):
    • Date
    • Thread