Aren't your arguments reversed? Shouldn't you call frename as

(jpath d,'comb.png') frename~ jpath d,'1.png'

?
The line
0=((unxlib 'c'), ' rename > i *c *c') 15!:0 y;x
has reversed the parameters of what `rename' expects. Please see `man
rename'

HTH,
Vijay.



On Sat, Dec 21, 2013 at 4:40 PM, Brian Schott <[email protected]>wrote:

> In a chat thread we have been discussing a task to rename the files in a
> directory. I am using J6, and to do so I want to use the verb frename from
> the standard j files script inside 'j602/system/main/files.ijs' on my Mac
> (which is considered a Unix -- IFUNIX -- box). But the verb frename is not
> working for me.
>
> Below is my demonstration that frename is not working for me.
>
>    d=.'~temp/archive1/'
>    fboxname=: ([: < 8 u: >) :: ]  NB. needed by frename,fexist
>    fexist=: (1:@(1!:4) :: 0:) @ (fboxname &>) @ boxopen
>    fexist jpath d,'comb.png'
> 1
> (jpath d,'comb.png') frename '1.png'     NB. why not a result '1'?
> 0
> (jpath d,'comb.png') frename jpath d,'1.png'     NB. why not a result '1'?
> 0
>
>
> NB. =========================================================
> NB. *frename v newname frename oldname - return 1 if rename ok
> frename=: 4 : 0
> x=. > fboxname x
> y=. > fboxname y
> if. x -: y do. 1 return. end.
> if. IFUNIX do.
>   0=((unxlib 'c'),' rename > i *c *c') 15!:0 y;x
> else.
>   'kernel32 MoveFileW > i *w *w' 15!:0 (uucp y);uucp x
> end.
> )
>
> Any ideas about what is causing my error?
>
> TIA,
>
> --
> (B=)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to