30 lines in VFP. As a bonus, you end up with a cursor of data, and an
on-topic thread!

CREATE CURSOR curFiles (filesPK int NOT NULL autoinc, extension c(12),
totalsize I)
INDEX on extension TAG extension
lnResult = recurse()
WAIT WINDOW NOWAIT "Completed counting " + TRANSFORM(lnResult) + "
directory entries"
BROWSE

FUNCTION Recurse (tcPath)
IF EMPTY(tcPath)
  tcPath = ".\"
ENDIF
LOCAL laDir[1], i, lnCount, lnResult
STORE 0 TO lnResult
lnCount=ADIR(laDir, tcPath+'*','D')
FOR i = 1 TO lnCount
  IF 'D' $ laDir[i,5]  && drill into subdirectories
    IF  LEFT(laDir[i,1],1) #'.'
      lnResult = lnResult + Recurse(tcPath+ADDBS(laDir[i,1]))
    ENDIF
    LOOP
  ENDIF
  * WAIT WINDOW NOWAIT tcPath+laDir[i,1]
  * ? tcPath+laDir[i,1]
  AddToFile(JUSTEXT(laDir[i,1]), laDir[i,2])
NEXT
RETURN lnCount + lnResult

FUNCTION AddToFile(tcExtension, tiFileSize)
  LOCATE FOR extension=tcExtension
  IF FOUND()
    replace totalsize WITH totalsize + tiFileSize NEXT 1 IN curFiles
  ELSE
    INSERT INTO curfiles (extension, totalsize) VALUES (tcExtension, tiFileSize)
  ENDIF
RETURN

On Wed, Oct 19, 2016 at 10:31 AM, Peter Cushing
<[email protected]> wrote:
> On 19/10/2016 14:51, Dave Crozier wrote:
>>
>> Or:
>>
>> for i in $(find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort
>> -u); do echo "$i"": ""$(du -hac **/*."$i" | tail -n1 | awk '{print $1;}')";
>> done | sort -h -k 2 -r
>>
>> Assuming you have extglob enabled:
>>    shopt -s extglob
>>
> Feck me Dave, what was that you were saying about Mandarin/unintelligible
> ;-)
>
> Peter
>
>
> This communication is intended for the person or organisation to whom it is
> addressed. The contents are confidential and may be protected in law.
> Unauthorised use, copying or disclosure of any of it may be unlawful. If you
> have received this message in error, please notify us immediately by
> telephone or email.
> www.whisperingsmith.com
>
> Whispering Smith Ltd Head Office:61 Great Ducie Street, Manchester M3 1RR.
> Tel:0161 831 3700 Fax:0161 831 3715
> London Office:17-19 Foley Street, London W1W 6DW Tel:0207 299 7960
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/cacw6n4uwhqkrnzdqeenm0c5ta_auc-_phfpqiv1pg001ng-...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to