delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/05/05/18:28:01

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,SPF_HELO_PASS,TW_YG,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
X-IronPortListener: Outbound_SMTP
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av4EAJ2opU+cKEcW/2dsb2JhbABFr0KDMIEHghMSKFEBCA0nAi8TJgEEARoah2ydb5wGin+FPWMEjTiOXooqgwU
From: "Buchbinder, Barry (NIH/NIAID) [E]" <BBuchbinder AT niaid DOT nih DOT gov>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>,
"'Cary Lewis'" <cary DOT lewis AT gmail DOT com>
Date: Sat, 5 May 2012 18:27:34 -0400
Subject: RE: find.exe vs. cmd.exe dir command vs. filesystem object in vbs script
Message-ID: <0105D5C1E0353146B1B222348B0411A20A6E685C26@NIHMLBX02.nih.gov>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q45MRsg8020452

Cary Lewis sent the following at Friday, April 27, 2012 10:29 AM
>I have a system that makes use of a number of directories which contain
>hundreds of thousands of files.
>
>The sheer number of files in the directories makes it very difficult to
>do simple things using cygwin.
>
>For example the find command takes a very long time to start outputting
>filenames.
>
>However, in a cmd.exe window, the dir.exe command immediately starts
>outputting files.
>
>I would like to find out which api calls the CMD dir.exe command is
>using vs. the cygwin find.exe program.
>
>In the end I want to build an efficient delete files utility based on
>date, type, etc. I also need to compare files in the filesystem with
>references in a database
>
>I am starting to think that I should use the CMD dir.exe command and by
>parsing its output, take appropriate action.
>
>Performance is further hampered by the files residing on a SAN.

I use cmd's DIR to just get file & directory names, finding it much faster
than find.

$ "$(cygpath -u "${COMSPEC}")" /c dir /s /b /a: /o:n "$(cygpath -w "${CygwinPath}")" | \
tr -s '\r\n' '\n' | \
cygpath -u -f -

(There might be a speed advantages to working up a sed script instead of using
cygpath.  Based on *no data*, I've assumed that cmd's speed advantage over find
is due to not stating files.  If cygpath stats files, sed might be faster.)

While you might be able to get cmd /c DIR to give you dates, that will
probably require use of gawk or the like.

- Barry
  Disclaimer:  Statements made herein are not made on behalf of NIAID.


--
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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019