ashishjain
8th October 2010, 16:21
Hi,
I am unable to move file to different directory on same server.
1. First i used file.mv command to move the file..
move.file = file.mv(file1.path,file2.path)
|Where file1.path = /home/aj/EDI/FOSO.txt
|and file2.path = /home/aj
But it did'nt work.
2. Then i used below shell command to move the file..
move.file = shell("mv file1.path file2.path", SHELL_NO_OUTPUT)
This is also not solving the problem & not moving the file.
User is having full permission to read/write/execute files from & to the server.
Can any one please help me in this regard or kindly tell me if there is any alternate way of doing this.
Quick reply would be appreciated
Thanks
BaanInOhio
8th October 2010, 16:50
I think that the file location (path) and file name are required for both arguments. Would result in something like:
status = file.mv("/home/aj/EDI/FOSO.txt", "/home/aj/FOSO.txt")
bdittmar
8th October 2010, 20:01
Hi,
I am unable to move file to different directory on same server.
1. First i used file.mv command to move the file..
move.file = file.mv(file1.path,file2.path)
|Where file1.path = /home/aj/EDI/FOSO.txt
|and file2.path = /home/aj
But it did'nt work.
2. Then i used below shell command to move the file..
move.file = shell("mv file1.path file2.path", SHELL_NO_OUTPUT)
This is also not solving the problem & not moving the file.
User is having full permission to read/write/execute files from & to the server.
Can any one please help me in this regard or kindly tell me if there is any alternate way of doing this.
Quick reply would be appreciated
Thanks
Hello,
check user rights in directory !
and:
extern string source.path.file(50)
extern string target.path.file(50)
long ret
source.path.file = "/home/aj/EDI/FOSO.txt"
target.path.file = "/home/aj/"
ret = file.mv(source.path.file, target.path.file)
BaanERP Programmers Guide
file.mv()
-------------------------------------------------------------------------
Syntax
long file.mv( const string source, const string target )
Description
This moves a specified source file to the location specified in the target argument. The file can be either local or remote. Both source and target must be on the same host.
Return values
1 Success.
<0 Error.
Regards
ashishjain
8th October 2010, 20:47
Thanx for replying Bernd :)
I am using the same way what you have told but still unable to move the file. User is having full permission to read, write & execute.
mark_h
8th October 2010, 22:12
Does the receive file already exist? If so check the permissions on the file. I know on the unix platform the admins can set it up so when I file is create not everyone can write over it(umask setup).
ashishjain
8th October 2010, 22:45
Hey mark thanks for replying. Receive file does not exist. I was just giving only the destination folder name where the file needs to move. After giving the receiving file name file.mv command is working fine & moving the file to respective location or you can say writing the contents of source file to destination file.
My only query is that can we move the same source file to destination path without giving any destination file name because user can change the destination file name at run time but we want to have the same file name at destination as on source.
shah_bs
8th October 2010, 23:34
Would you be able to try changing SHELL_NO_OUTPUT to SHELL_MWINDOW temporarily, so you can see what error message comes up on the command window?
The file.mv() help does not specify that the target has to be a FILE, so I suppose it can be a DIRECTORY. Never used this command so not sure.
BaanInOhio
8th October 2010, 23:41
Would you be able to try changing SHELL_NO_OUTPUT to SHELL_MWINDOW temporarily, so you can see what error message comes up on the command window?
The file.mv() help does not specify that the target has to be a FILE, so I suppose it can be a DIRECTORY. Never used this command so not sure.
I believe that it could vary based on the OS. I have used it successfully both ways -- with a file name on the target and without. On the HP UX environment, I had to specify the file name in the target. Leaving it off provided the "generic" error in the returned log variable (-13, I think). Same with server2client() in Unix to windows.
mark_h
8th October 2010, 23:49
Hey mark thanks for replying. Receive file does not exist. I was just giving only the destination folder name where the file needs to move. After giving the receiving file name file.mv command is working fine & moving the file to respective location or you can say writing the contents of source file to destination file.
My only query is that can we move the same source file to destination path without giving any destination file name because user can change the destination file name at run time but we want to have the same file name at destination as on source.
I don't think so but you can just use whatever filename the user provides - I assume you prompt for the file name.
from.file = "/home/aj" & input.name
to.file = "/home/aj/edi" & input.name
You could also do this with the user providing the full path. Or you can shell out to use the unix command mv.