Copy and rename file in X++


I have a problem in renaming file generated by Axapta report, I am generating file in .xls and placing that file on the other server, but I wants to copy this file to other location after generating completely, please let me know how to copy this to other location as well rename same the file by X++.

Suppose i am generating a file by name A at the location C:\TestFolder, after generating the file i wants to place this file on D:\FinalFolder by name B, how this can be achieved by X++,

Thanks in Advance.

you must use winapi fonctions

str FileA= “C:\TestFolder\A.txt”;

str FileB= “D:\FinalFolder\B.txt”;


winapi::copyfile(FileA, FileB);