This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: find.exe vs. cmd.exe dir command vs. filesystem object in vbs script


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]