cancel
Showing results for 
Search instead for 
Did you mean: 

Date and Time in Sender File Adapter Target Directory

Former Member
0 Kudos

Hi there,

is there a way of using Date and Time from XI to the Target Directory naming? To use variable substitution some fields of the message had to contain that date and time information, which is not our case.

For filename you can use "add time stamp" option, but and for target directory?

Thanks and regards,

Henrique.

Accepted Solutions (0)

Answers (2)

Answers (2)

henrique_pinto
Active Contributor
0 Kudos

Solved with Dynamic Configuration.

Best regards,

Henrique.

moorthy
Active Contributor
0 Kudos

HI,

You can do variable substitution for that. Like you are doing for the dynamic filename.

http://help.sap.com/saphelp_nw2004s/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm

For this one of the payload should contain the field with the date format etc.

Regards,

moorthy

henrique_pinto
Active Contributor
0 Kudos

As I said in my first message, we don't have date and time fields in our messages, nor can change them (they are expected that way by a webservice).

Any other way?

moorthy
Active Contributor
0 Kudos

As per the standard adapter , there is no other way..

<i>change them (they are expected that way by a webservice).</i>

1) But you are writing into a file right..am i right? Just a suggestion, if you have one extra segment in the file , which contains the dynamic date information, you can delete this data from the File with the help of CUT parameter in the content conversion ( This works out if you have content conversion)

2)Only option is writing a shell script and executing this from the OS command etc..

Regards,

Moorthy

henrique_pinto
Active Contributor
0 Kudos

We are using this adapter to write the messages which are sent to a webservice in .xml format to a file repository. But the messages MUST be archived exactly as they are sent to the webservice, for fiscal matters.

So, if even the hash code or send time are different from the file sent to the webservice, this could create some problems to our legal department.

Do you have further information on how to perform this with shell commands?

Thanks a lot for your help,

Henrique.

moorthy
Active Contributor
0 Kudos

<i>Do you have further information on how to perform this with shell commands?</i>

>> You need to write a shell script. This script will add the date/time stamp into the folder in the target system. This shell script is executed from the File adapter. So once the file is written into the target directory, then it will rename the directory.

For it should happen, your target directory should be in XI server itself. i.e you need to use NFS protocol. If you are writing into FTP server, then you need to altogether different way .

Can't you use the timestamp for the files only ? Is it is not ok with the business requirement. Because while archiving you can add timestam etc.

Regards,

Moorthy

Regards,

Moorthy

henrique_pinto
Active Contributor
0 Kudos

The files writen in this file repository will be managed by KM, and a folder tree based on date (year/month/day) would grant the optimal performance for the crawler.

The KM's machine target root directory was already mapped into XI's machine (done by our basis team), and they provided me a folder. So, for me, accessing the file repository will be as accessing a local folder.

Do you have any material on shell scripts?

I have never done one before, and I'll need some reading before I can manage to do this.

Thanks a lot,

Henrique.

henrique_pinto
Active Contributor
0 Kudos

> <i>Do you have further information on how to perform

> this with shell commands?</i>

> >> You need to write a shell script. This script will

> add the date/time stamp into the folder in the target

> system. This shell script is executed from the File

> adapter. So once the file is written into the target

> directory, then it will rename the directory.

Hi there, Moorthy

We've tried to write that shell script that you mentioned, but now we have a few doubts on how to make it create the proper directory.

In the file adapter, my target directory is "/%var1%/%var2%/", where %var1% and %var2% are variable substitutions, referencing data which comes from the payload. Now, I need the shell script to append "/<Year>/<Month>/" in the target directory. But where to archive the script? If it stays in the root directory, than how to make it create "/<Year>/<Month>/" folders inside a directory which is variable (/%var1%/%var2%/)?

Is there a way of passing %var1% and %var2% as parameters for the shell script?

Thanks a lot,

Henrique.

moorthy
Active Contributor
0 Kudos

Hi,

First of all is your target directory is in XI server itself.i.e are you using NFS Protocol ?

You need to use Execute OS command after the file processing option in the Reciever File Adapter.

Anyway you are able to generate the dynamic names for the Directory right? Let it create a folder and file, then execute the shell script, which will read that entire folder, and rename the folder with date/time stamp. This logic, is without passing any parameter to the shell script. Shell script is having a logic of reading all the directories and change the directory name.

Using parameter to the script-

If you give %F (absolute file name including path) in OS command, which will give you file name with entire path.Use this as a parameter and try it.

Hope it works.

Regards,

Moorthy

henrique_pinto
Active Contributor
0 Kudos

So the script will have to track all the files in the directory and rename it's path to the corretc one, is that so?

moorthy
Active Contributor
0 Kudos

Hi,

<i>So the script will have to track all the files in the directory and rename it's path to the corretc one, is that so?</i>

>>Kind of ,but it is not worried about files here. Only directory name.

In detail-

Now you have got dynamic Directory name and file. Pass this info to your script. Script will take the directory name from this input parameter and rename it.

Regards,

Moorthy