AX 2012: Moving File to another Folder using System.IO.File

static void ArisMoveFileUsingSystemIOFile(Args _args)
Set permissionSet;
Filename fPath;
Filename fName;
Filename fType;

Filename sourcePath = @’D:\SourceFolder\test.csv’;
FileName DestinationPath = @’D:\DestinationFolder\’;


permissionSet = new Set(Types::Class);
permissionSet.add(new FileIOPermission(sourcePath,#io_write));
permissionSet.add(new InteropPermission(InteropKind::ClrInterop));


[fPath, fName, fType] = fileNameSplit(sourcePath);

System.IO.File::Move(sourcePath, strFmt(‘%1%2%3’, #destinationPath, fName, fType));


Box::info(‘File\s moved successfully!’);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s