How to transfer a file from one location into another in wM?

Anyone assist me how to write a java services to transfer a file from one location to another…FTP or normal…I tried the below code…

// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
String sFile = IDataUtil.getString( pipelineCursor, “SourceFile” );
String dFile = IDataUtil.getString( pipelineCursor, “DestinationFile” );
pipelineCursor.destroy();
try
{
FileReader fin = new FileReader(sFile);
FileWriter fout=new FileWriter(dFile,true);
int c;
while((c=fin.read()) != -1)
{
fout.write(c);
}
System.out.println(“File Copied…”);
fin.close();
fout.close();
}
catch(FileNotFoundException fnf)
{
System.out.println(“File not found”);
}
IDataCursor pipelineCursor_1 = pipeline.getCursor();
IDataUtil.put(pipelineCursor_1, “msg”, “Welcome” );
pipelineCursor_1.destroy();
It shows unreported exception error…

I think you might be trying to reinvent the wheel here. What version of the IS are you on?

If on 8.0 then use the service pub.file:moveFile in WmPublic package.
If on 7.x refer to the service PSUtilities.file:moveFile for more information in PSUtilities package.

Cheers,
Akshith

And if you need FTP, use the built-in services.