assassinator
4th September 2008, 10:55
How to use file.cp()? I have found some replies in Baan forum, but I still can't get it.
declaration:
#pragma used dll ottdllbw
......
file.name = "C:\COG_LCM\Tools.txt"
file.no = seq.open.local(file.name, "r", false)
if file.no <> 0 then
ret = file.cp("C:\COG_LCM\Tools.txt","C:\COG_LCM\Tools_backup.txt")
ret = file.rm(file.name)
endif
But the return value of ret always is -1 .
wiggum
4th September 2008, 11:51
file.cp copies files at the baan server not at the client use start.application.local instead.
assassinator
4th September 2008, 12:11
file.cp copies files at the baan server not at the client use start.application.local instead.
Ture? But the description of file.cp was said, local or remote would be OK.:confused:
dhanushya
4th September 2008, 15:03
you can use file.cp() for both i.e local as well as remote.
but as per your code you are opening file for reading and then try to copy,
actually no need to do that.
you just wite file.cp(source file, destination fiel) insted of file.no = seq.open.local(file.name, "r", false) your code should be like this:-
file.name = "C:\COG_LCM\Tools.txt"
ret = file.cp("C:\COG_LCM\Tools.txt","C:\COG_LCM\Tools_backup.txt")
if ret < 0 then
|* error file can not be copied
else
ret = file.rm(file.name)
endif
assassinator
5th September 2008, 04:04
Thanks for your replies. I did as you said, but the file.cp() still returned -1.:confused:
And I tested ret = file.cp("C:\COG_LCM\Tools.txt","D:\Tools_backup.txt"), ret was -1 too.
you can use file.cp() for both i.e local as well as remote.
but as per your code you are opening file for reading and then try to copy,
actually no need to do that.
you just wite file.cp(source file, destination fiel) insted of file.no = seq.open.local(file.name, "r", false) your code should be like this:-
file.name = "C:\COG_LCM\Tools.txt"
ret = file.cp("C:\COG_LCM\Tools.txt","C:\COG_LCM\Tools_backup.txt")
if ret < 0 then
|* error file can not be copied
else
ret = file.rm(file.name)
endif
wiggum
5th September 2008, 11:44
You can copy remote files with file.cp like UNIX command rcp but usually not possible with windows clients. How should file.cp know which file you want to copy if the file exists on server and also on client?
csecgn
7th September 2008, 12:41
If I understand file.cp() correct, you can copy local files (remote is possible) but file.cp() is executed on your server.
So if you want to copy local files you need to have access to this files i.e. by an UNC filename/path.
hth
Regards
Christof
assassinator
8th September 2008, 04:34
As your said, file.cp() would copy a temporary file in UNIX Server at first? :eek:If that is true, as silly as a goose. I can use client2server and server2client to solve it.
If I understand file.cp() correct, you can copy local files (remote is possible) but file.cp() is executed on your server.
So if you want to copy local files you need to have access to this files i.e. by an UNC filename/path.
hth
Regards
Christof
csecgn
8th September 2008, 20:54
Sorry. You are right. I should read the manual twice (and don't mix two topics). There is a clear satement hat the bshell needs to be able to access target and destination. I've used it sometimes on the server, but not on the client.
Regards
Christof
assassinator
9th September 2008, 04:49
OK, thanks for your replies. By the way, you used file.cp() on the server is it like the followed:
ret = file.cp("/baan_dump/mrp_log/transfer","/baan_dump/mrp_log/transfer200808")
Sorry. You are right. I should read the manual twice (and don't mix two topics). There is a clear satement hat the bshell needs to be able to access target and destination. I've used it sometimes on the server, but not on the client.
Regards
Christof