I loaded in the base library s well as some directory add-ons, so it looks
like all the nouns are covered:

   each
┌──┬─┐
│&.│>│
└──┴─┘
   empty
┌┬─┬─┐
││"│_│
└┴─┴─┘

   dir
┌─┬─┬─────────────────────────────────────────────────────┐
│3│:│'n' dir y                                            │
│ │ │:                                                    │
│ │ │ps=. PATHSEP_j_                                      │
│ │ │y=. y,(0=#y)#'*'                                     │
│ │ │y=. y,((':',ps) e.~ {:y)#'*'                         │
│ │ │if. 0=#dr=. 1!:0 y do. empty'' return. end.          │
│ │ │fls=. 'd' ~: 4{"1>4{"1 dr                            │
│ │ │if. (1=#dr) *. 0={.fls do.                           │
│ │ │  r=. x dir y,ps,'*'                                 │
│ │ │  if. #r do. r return. end.                          │
│ │ │end.                                                 │
│ │ │if. fmt=. 2=3!:0 x do. opt=. 2 1                     │
│ │ │else. opt=. 2{.x end.                                │
│ │ │if. 0={:opt do. fls=. 1#~#dr=. fls#dr end.           │
│ │ │if. 0=#dr do. empty'' return. end.                   │
│ │ │nms=. {."1 dr                                        │
│ │ │nms=. nms ,&.> fls{ps;''                             │
│ │ │if. IFWIN32 do.                                      │
│ │ │  nms=. tolower &.> nms                              │
│ │ │end.                                                 │
│ │ │ndx=. /: (":,.fls),.>nms                             │
│ │ │if. 0=opt do.                                        │
│ │ │  list >ndx{nms                                      │
│ │ │elseif. 1=opt do.                                    │
│ │ │  path=. (+./\.y=ps)#y                               │
│ │ │  path&,&.>ndx{nms                                   │
│ │ │elseif. fmt<2=opt do.                                │
│ │ │  ndx{nms,.}."1 dr                                   │
│ │ │elseif. fmt do.                                      │
│ │ │  'nms ts size'=. |:3{."1 dr                         │
│ │ │  if. IFWIN32 do.                                    │
│ │ │    nms=. tolower L:0 nms                            │
│ │ │  end.                                               │
│ │ │  ds=. '   <dir>    ' ((-.fls)#i.#fls) } 12 ":,.size │
│ │ │  mth=. _3[\'   JanFebMarAprMayJunJulAugSepOctNovDec'│
│ │ │  f=. > @ ([: _2&{. [: '0'&, ": )&.>                 │
│ │ │  'y m d h n s'=. f&> ,<"1 |: 100|ts                 │
│ │ │  m=. (1{"1 ts){mth                                  │
│ │ │  time=. d,.'-',.m,.'-',.y,.' ',.h,.':',.n,.':',.s   │
│ │ │  dat=. (>nms),.ds,.' ',.time                        │
│ │ │  dat /: fls,. /:/: >(3|'dns'i.x){ts;nms;size        │
│ │ │elseif. 1 do.                                        │
│ │ │  'invalid left argument'                            │
│ │ │end.                                                 │
└─┴─┴─────────────────────────────────────────────────────┘

However, when I put Ric's code in the .ijs file and run it I get:

 load 'c:\users\skip cave\j602-user\projects\asr1.ijs'
|spelling error
|   ; (<empty'') -.~ (1 dir ,&'/LOG') each C:\test1\ 'jsource'
|                                          ^
|[-2] c:\users\skip cave\j602-user\projects\asr1.ijs

It looks like it doesn't like the directory path.

Skip

On Fri, Nov 4, 2011 at 12:02 AM, Ric Sherlock <[email protected]> wrote:

>   each
> &.>
>   empty     NB. definded in stdlib in J7 (but not J6 I think)
> (i.0 0)"_
>   load 'dir'   NB. required in J6.02 but loaded automatically in J7
>
> As far as I know there is no J addon/library that handles gzipped
> files. There are however windows versions of gunzip and as I mentioned
> before 7z handles gzip too.
> I suspect you will just be able to use &.> (aka each) to "loop
> through" your files.
>
> If you provide a simple example of the sort of text you're wanting to
> process I think it will be easier for us to point you in the right
> direction. E. is likely to be involved though.
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to