cancel
Showing results for 
Search instead for 
Did you mean: 

Archive processed files at receiver file adapter

0 Kudos

Hi Experts,

I need to archive(copy) processed messages from the target folder to another folder.

I tried using the Run OS Command after processing and not sure with the exact command.

Can anyone please provide the exact command (syntax) for copying file from the target file folder to another folder.

Do we need any authorization from BASIS team to perform this command in run OS Commandline please.

Note: the original file should not be deleted.

Thanks in advance!

Regards,

Mahakrishnan T.

Accepted Solutions (1)

Accepted Solutions (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Mahakrishnan T.,

OS command depends upon the operating system running in target system. You have not specified it in your post.

if your OS is UNIX/LINUX

try this following command (assuming the folder you wanna copy to is "/usr/target_folder")


cp %F  /usr/target_folder

for windows try this following command (assuming the folder you wanna copy to is "c:\apps\target_folder")


copy %F c:\apps\target_folder

Regards

Anupam

0 Kudos

Hi Anupam,

Thanks for providing the commandline.

We are using Windows server and tried with the commandline i had provided is copy %F //xxxxx/Test/SAPERP/FI/OUT/Ixxx/OUT/xxxx/ARC but i am not getting the processed files in the ARC folder.

I have even tried with copy %F
xxxxx\Test\SAPERP\FI\OUT\Ixxx\OUT\xxxx\ARC
and there is no processed filed get placed in the ARC folder.

Can you provide the exact way of providing the target path please?

anupam_ghosh2
Active Contributor
0 Kudos

Hi Mahakrishnan T.,

The target folder you are specifying should begin with drive name such as "c:\" or "d:\" etc.

In your case your target folder begins with "//xxxxx" . So are you trying to write to some system using IP address ? or are you using FTP in receiver file adapter?

regards

Anupam

0 Kudos

Hi Anupam,

Thanks again for your reply.

Yes. I am using FTP Receiver communication channel.

for the FTP target folder, i have in *
xxxx\yyy\zzzz* format.

I dont know, how to convert this in C:\ , D:\ etc.

When i asked, they said, its trusted system and the path use to be like this.

Kindly suggest me on the path, which i have to provide in order to copy the file in the target folder.

anupam_ghosh2
Active Contributor
0 Kudos

hi Mahakrishnan Thangam,

I used the OS command feature where FTP is not used and it worked in the way I already posted. When it comes to FTP in receiver file adapter you need a batch file and a script both on PI server. The script will function as follows

1. Login to FTP server.

2. change to target folder you specified in target directory in cc.

command: cd foldername

3.Read the file created by receiver file adapter in remote FTP location. File will be copied to local directory of PI server.

command: get filename

4. Now again change remote directory to archive directory.

5. Copy the file back to FTP server again from local directory to archive directory you want to copy to.

Now from batch file call this script.

Would suggest to read these links carefully

http://wiki.sdn.sap.com/wiki/display/XI/SAPXIFileAdapterOSCommandLine+Feature

http://www.cs.colostate.edu/helpdocs/ftp.html

Alter algorithms to meet your requirement.

Hope this solves your problem.

Regards

Anupam

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Maha,

Where you want to post the file to ? Is that folder a share drive or another folder in PI local drive?

You can do it two ways:

1. Either configure a sender channel that wil pick the files from that folder and place it to the target folder ,without any mapping (use mapping bypass). Incase the file is a network/shared folder, you got to have the access for the PI system user to write to that particular folder.

2. You can do write power shell script to transfer the files from source to target. Somthing like this: save it as .ps1 file

function movefiles([string]$source,[string]$target)

{

$directory = [System.IO.FileAttributes]::Directory

Get-ChildItem $source -Recurse | where {($_.Attributes -band $directory) -ne $directory} | foreach {

$srcitem = $_.FullName

$relitem = $_.FullName.Replace($source,"")

$trgitem = Join-Path $target $relitem

$trgdir = Split-Path($trgitem)

Move-Item "$srcitem" "$trgdir"

}

}

movefiles "Source " "targetpath"

Hope this helps!

Regards,

Sushama