[Jprogramming] frename: file rename
Brian Schott
schott.brian at gmail.com
Sat Dec 21 21:40:16 UTC 2013
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=)
More information about the Programming
mailing list