cancel
Showing results for 
Search instead for 
Did you mean: 

Dbmaint os error

hoffmanroni
New Contributor III
I am trying to rename a column using dbmaint but am getting an os error.

\d .os
WIN:.z.o in`w32`w64
pth:{p:$[10h=type x;x;string x];if[WIN;p[where"/"=p]:"\\"];(":"=first p)_ p}
cpy:{system$[WIN;"copy /v /z ";"cp "],pth[x]," ",pth y}
del:{system$[WIN;"del ";"rm "],pth x}
ren:{system$[WIN;"ren ";"mv "],pth[x]," ",pth y}
here:{hsym`$system$[WIN;"cd";"pwd"]}
\d .

renamecol:{[dbdir;table;oldname;newname] / renamecol[`:/k4/data/taq;`trade;`woz;`iz]
 if[not validcolname newname;'` sv newname,`invalid.newname];
 rename1col[;oldname;newname]each allpaths[dbdir;table];}

rename1col:{[tabledir;oldname;newname]
 if[(oldname in ac)and not newname in ac:allcols tabledir;
  stdout"renaming ",(string oldname)," to ",(string newname)," in `",string tabledir;
  .os.ren[` sv tabledir,oldname;` sv tabledir,newname];@[tabledir;`.d;:;.[ac;where ac=oldname;:;newname]]]}


Anyone have any ideas?  I think the .os.ren is causing it.  I have used other dbmaint functions without issue.
4 REPLIES 4

keevey
New Contributor II
Which operating system?

Do you have the requisite permissions to rename the file?

hoffmanroni
New Contributor III
Using Windows 8.1

Yes I have permissions

keevey
New Contributor II
Seems ren on windows doesn't like a path being specified for the target.

Using move should fix this,

i.e.

.os.ren:{system$[WIN;"move ";"mv "],pth[x]," ",pth y}

hoffmanroni
New Contributor III
Yea works, Thanks!