Can't move a file in batch.

Hi all, I need to process some files then move them to a different location, all this done in batch. It works fine outside of batch, but I cant seems to figure out why it wont run in batch. The file locations are on the server, and I have full access.

public void moveFile()

{

FilePath fpath;

Filename fname;

InteropPermission interopPerm;

FileIOPermission filepermission;

Set permissionSet;

fpath = @’\Server\Test\test.ord’;

fname = @’\Server\Test\TestArchive\test.ord’;

filepermission = new FileIOPermission(fname, ‘RW’);

interopPerm = new InteropPermission(InteropKind::ClrInterop);

permissionSet = new Set(Types::Class);

permissionSet.add(interopPerm);

permissionSet.add(filepermission);

CodeAccessPermission::assertMultiple(permissionSet);

System.IO.File::Copy(fpath,fname);

CodeAccessPermission::revertAssert();

/*interopPerm = new InteropPermission(InteropKind::ClrInterop);

interopPerm.assert();

System.IO.File::Copy(fpath,fname);*/

}

I’ve set the RunOn propetrty to calledFrom, client and server, but none seem to have any effect. Any ideas?

Hi all, just an update. After hours frustration, I finally managed to get it to work.

I quote axaptapedia:

“When the job is executed by the batch server, the new, unpack and run methods are the only methods called by the RunBaseBatch framework”.

All I had to do was override the run method and place the code in here. I of course then did a full CIL for completeness.