cancel
Showing results for 
Search instead for 
Did you mean: 

changing of the timestamp in sender file adapter in archive mode

Former Member
0 Kudos

Hi,

I have a requirement where in I have to archive a file with timestamp different from that generated by XI.

Please let me know if this can be done and if so how can we handle the changes to be made to the timestamp in the sender adapter in archive mode.

regards,

Srinivas.

Accepted Solutions (1)

Accepted Solutions (1)

Satyagadadas
Active Participant
0 Kudos

Hi,

Wrtite your script to archive files, and execute this script in "Run os

coomand after message processing', in this script it adds your own time stamp and archives the file

Former Member
0 Kudos

Hi Satyanarayana,

Thanx for the reply but could you send me any sample code for the OS commands.

regards,

Srinivas

Former Member
0 Kudos

Hey

first of all save your archive file with the same timestamp as the sender file,then you will have a script which will use the mv command and will rename this file with a different time stamp

use the following command in yoru script

mv <FileName_OldTimestamp> <FileName_NewTimestamp>

Thanx

Aamir

former_member181985
Active Contributor
0 Kudos

Hi Aamir,

I have a doubt.

The script you mentioned is fixed logic and wont apply for all the files in the directory.

Thanks

Gujjeti

former_member181985
Active Contributor
0 Kudos

Can you give me your time stamp format sample.

Thanks

Gujjeti

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

The requirement here is for a dynamic timestamp while archiving the file in sender Communication Channel ie generated new timestamp depending on the one created by XI.

Let me explain the requirement again ::

My requirement is to actually append the file name with a time stamp of a different timezone for example if the XI server is in the US and the FTP server is in Europe. As of now the file that is archived is created with a timestamp (format yyyyMMddHHmm) of the XI server. But I need the file name to have the Europe timestamp appended to the file name.

for Ex :: 042120081359_Filename.txt (US Timestamp) should be renamed as 042120081959_Filename.txt (Europe TimeStamp -- US Time + 6hrs).

For this first I have to pick the one that is created with the US timestamp and then change it to the European timestamp.

Please let me know how this can be done?

Thanx in advance.

regards,

Srinivas

ravi_raman2
Active Contributor
0 Kudos

Srinivas,

Option 1) Create a bat file..to run the perl script you call..

Perl script..

#!/usr/bin/perl -w

print("Starter that you want to change: ");

chomp($badex = <STDIN>);

print("Starter that you want added: ");

chomp($goodex = <STDIN>);

foreach $file (<$badex*>){

@fields = split(/$badex/,$file);

$goodfile = ("$goodex" . "$fields[1]");

rename("$file","$goodfile");

}

Run that on the os

That should fix it.........

Option 2) On your local Machine create a java file..add this code to it

public class Utils

{

public static int Randomizer(){

int randomInt = 0;

randomInt = (int) (Math.random()*1000);

return randomInt;

}

public static void main(String[] args)

{

Randomizer();

}

}

save and compile..

Create a bat file to add the number returned from the random to your targetFilename

so it would be something like..

mv oldFileName Newfilename+randomizer... and also get this command written to a file..helpful later on.........

Hope that helps

Regards

Ravi Raman

PS:Dont forget the points if helpful

Former Member
0 Kudos

Hi,

Check these to achieve the requirement.

Use the OS command to do this in Sender file adapter.

http://www.simotime.com/ftp4cmd1.htm

/people/sameer.shadab/blog/2005/09/21/executing-unix-shell-script-using-operating-system-command-in-xi

/people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions

/people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching

http://help.sap.com/saphelp_nw70/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm

Regards

Seshagiri