MOVE FILE FROM ONE FOLDER TO ANOTHER FOLDER USING X++

Below is for Moving files in Batch Job process :

server static void moveFile(str fileName, str newFileName)
{
    Set                 permissionSet;
    permissionSet =  new Set(Types::Class);
    permissionSet.add(new FileIOPermission(fileName, #io_write));
    permissionSet.add(new FileIOPermission(newFileName, #io_write));
    permissionSet.add(new InteropPermission(InteropKind::ClrInterop));
    CodeAccessPermission::assertMultiple(permissionSet);
    System.IO.File::Move(fileName, newFileName);
    CodeAccessPermission::revertAssert();
}
Advertisements