[SLUG] Re:Re:Re:Largest File

Jamie Adams thefatsamurai at yahoo.co.uk
Wed Mar 22 14:42:58 GMT 2006


On Wed, 2006-03-22 at 14:50 +0000, Al Girling wrote:

> 
> I've tried Jamie's bash script, but it complains of an unexpected token
> and I don't know enough of bash scripting to make it work. :(
> 
> You'd think this would be a simple thing to do, but I can't think how.
> 
> Toodle pip,
> 
> Al
> 

I think it is because one of the lines wrapped - I have numbered the
lines now:

1: cd /home/adamsj

2: for line in ` du -a -b 2>/dev/null| sort -g -r |head -n 200| sed
s/^[0-9]*s*//g`

4: do

3: if [ -f $line ]; then
4:    echo `du -h $line`

5: fi

6: done

Seems to work for me.. I get an output like this:


adamsj at minerva:~/Scripts$ ./largefile.sh
6.5M ./.cpan/Metadata
2.3M ./.icons/SnowIsh-1.0/scalable/categories/gnome-office.svg
2.1M ./.icons/SnowIsh-1.0/scalable/apps/preferences-desktop-wallpaper.svg
2.1M ./.icons/SnowIsh-1.0/scalable/mimetypes/x-directory-desktop.svg
2.1M ./.mozilla/plugins/libflashplayer.so
2.1M ./.icons/SnowIsh-1.0/scalable/apps/accessibility-directory.svg
2.1M ./.icons/SnowIsh-1.0/scalable/actions/system-lock-screen.svg
2.1M ./.icons/SnowIsh-1.0/scalable/apps/beep-media-player.svg
2.1M ./.icons/SnowIsh-1.0/scalable/apps/preferences-system-session.svg
2.1M ./.icons/SnowIsh-1.0/scalable/apps/xmms.svg

<snip>

I have attached it anyway.. sorry if this bothers anyone!

Jamie

-------------- next part --------------
A non-text attachment was scrubbed...
Name: largefile.sh
Type: application/x-shellscript
Size: 153 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/scarborough/attachments/20060322/5fd95aeb/largefile.bin


More information about the Scarborough mailing list