I do have a port of Unix find on my current Windows machine.
But I do not have that on the machine I back up to (my wife's), so I
would need to install that, and its dependencies, which makes me
reluctant to take that approach.

I, like many people, have had problems with find, but I thought I would
try your suggestion.  There are "quirks" with the time reporting, and
probably other issues I have forgotten.  I do not know exactly how to
set the argument to -printf and it is not explained in the help (shown
below).  If you send an example I would try that.

Here are a few lines from the output of
\bin\find -print -ls

 94573    0 drwxr-xr-x   6 a071046  Administ        0 Sep 21 15:05 ./ant
./ant/bin
 95124    0 drwxr-xr-x   2 a071046  Administ        0 Sep 21 15:05
./ant/bin
./ant/bin/ant
 95128    3 -rwxr-xr-x   1 a071046  Administ     5140 Apr 16  2003
./ant/bin/ant
./ant/bin/ant.bat

Note each file is on two lines.  Probably that is the default for -ls.
Also date and time are combined into three fields, but the third is
either time or year.  This makes it harder to process.  I would actually
prefer time in seconds since the start of the Unix eon.
Also there is no easy way to distinguish Files from Directories except
by further parsing of the permissions string, e.g. drwxr-xr-x.

Here is the help.  I cannot figure out how to suppress certain useless
fields e.g. inode and owner, nor put output on one line, etc.  

C:\foo>\bin\find -help
Usage: /bin/find [path...] [expression]
default path is the current directory; default expression is -print
expression may consist of:
operators (decreasing precedence; -and is implicit where no others are
given):
      ( EXPR ) ! EXPR -not EXPR EXPR1 -a EXPR2 EXPR1 -and EXPR2
      EXPR1 -o EXPR2 EXPR1 -or EXPR2 EXPR1 , EXPR2
options (always true): -daystart -depth -follow --help
      -maxdepth LEVELS -mindepth LEVELS -mount -noleaf --version -xdev
tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
      -cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group
NAME
      -ilname PATTERN -iname PATTERN -inum N -ipath PATTERN -iregex
PATTERN
      -links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
      -nouser -nogroup -path PATTERN -perm [+-]MODE -regex PATTERN
      -size N[bckw] -true -type [bcdpfls] -uid N -used N -user NAME
      -xtype [bcdpfls]
actions: -exec COMMAND ; -fprint FILE -fprint0 FILE -fprintf FILE FORMAT
      -ok COMMAND ; -print -print0 -printf FORMAT -prune -ls

Thanks for the suggestion, but it is probably faster to write the perl
that use find.
Steve


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jeremy Muhlich
Sent: Friday, September 23, 2005 12:19 PM
To: boston-pm@mail.pm.org
Subject: Re: [Boston.pm] script to "normalize" output of Windows dir
command


How about the unix "find" command, with the -printf option?  You can get
it through cygwin.  Taking find's output (even without -printf) from two
directories and diffing it has gotten me through most of these sorts of
problems.

Also, diff -r might be helpful.  (possibly with the --brief option as
well)


 -- Jeremy


On Fri, 2005-09-23 at 11:55 -0400, Tolkin, Steve wrote:
> Summary:
> I would like a perl script that converts the output of the Windows dir
> command so that each line has the same format, including the directory

> C:\_from_laptop\AAA BBB_files|abc||File|123|2003-04-14|10:21
> C:\_from_laptop\AAA BBB_files|empty.jpg|txt|Dir|0|2003-04-14|23:00


 
_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm
 
_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to