X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=sXzx40Ke9I2tQLAm eoP2Sdf2iLheE1K5sCJyskDcMNCC3J+35eMjQqMhMHlBX4vaE/hVaAsl2dDWhl14 EbApVRCt1siQFJcJshLksK7B2sQCyP2S72rhDYKo6t5ZStxt69UruDSPJwbDFNGZ qzVrgDOsRF9umoy8iME/PpxfiRM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=iY89erBtmfV7GMlQ0p3DLf rl22s=; b=kIWBs9s7OebzH/zHiYH/wQbIMaG+uYMDSQLY7F2724G4Qn18mt1Vd5 id5EX65KpqWfLN2Z6uTXnWy+NnpzWe+Kc1TThVD2sKdMgQt0dvTDLOt99La+lLVc 6iCYlSPzQReSyhgAkpbQxclYOhkd+bIQ7fVbJwCZCOvQILmO5IM/A= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_05,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=Repin, Hx-spam-relays-external:shaw.ca, H*r:shaw.ca, andrey X-HELO: smtp-out-so.shaw.ca Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca Subject: Re: RFE: find -d -size 0 => doesn't find empty directories To: cygwin AT cygwin DOT com References: <5BDA347D DOT 8070909 AT tlinx DOT org> <1792215646 DOT 20181101191249 AT yandex DOT ru> From: Brian Inglis Openpgp: preference=signencrypt Message-ID: <787c5490-d4a8-46e1-20d6-e7fc9a1f5db8@SystematicSw.ab.ca> Date: Thu, 1 Nov 2018 23:05:08 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1792215646.20181101191249@yandex.ru> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes On 2018-11-01 10:12, Andrey Repin wrote: > L A Walsh wrote: >> Unfortunately, due to directories really not being in the user >> disk data space, but in the MFT(zone) (I think), the size >> comes back as zero ('0') for directories. >> Would it be possible (if not problematic) for the cygwin >> emulation layer to return some non-zero value if the >> directory has actual entries in it (ignoring structural >> values like "." and "..")? Maybe return as 'size' either >> a dummy number proportional to #entries (like 10*#entries), >> or something like summing up actual number (+1) of characters >> in the file list? >> Would that be difficult to do, or add? > Having something to this extent would be useful in case of searching for > directories with too many files, for example. > I'd vote for something like (entries << 7), which is closer to an average ext2 > counter. No need to ignore anything. I believe readdir(3) overhead is already high, and adding extraneous lookups to add metadata which is not readily available under NTFS/exFAT would slow it even further. Do you really want readdir(3) or stat(3) to recurse to sum the entry sizes for each subdirectory? Some of us have some large messy directories more reminiscent of Unix systems than typical of Windows systems. $ time du -sh /tmp/ 91M /tmp/ real 0m5.125s user 0m0.125s sys 0m1.077s $ time du -sh /var/log/ 496M /var/log/ real 0m42.725s user 0m0.687s sys 0m9.139s -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada This email may be disturbing to some readers as it contains too much technical detail. Reader discretion is advised. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple