Skip to Content
0

Copy and add timestamp to file using Receiver channel OS command line

Mar 09 at 06:30 AM

76

avatar image

Hi All,

I am trying to create a copy of the file that is being created and add timestamp to the filename using OS command line inside Receiver channel.

I am able to copy the file but facing issue while adding timestamp to file copied.

Below is the code I am using inside OS command line:

cp %F /targetdirectory/test1.txt

Please suggest a way to add timestamp just using above code.

Thanks,

Aamir

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Aamir Khan Mar 18 at 06:52 AM
0

Hi All,

I created another Business Component and created new communication channels to copy these files with the existing mapping and added these newly created channels to the Business Component. After this I am able to get a copy of files.

Thanks,

Aamir

Share
10 |10000 characters needed characters left characters exceeded
Jens Schwendemann Mar 09 at 04:48 PM
0

Not an expert to UNIX / Linux shell but try that:

cp %F "/targetdirectory/test1$(date +'%Y%m%d%H%M%S')"
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Jens,

The code you have provided is not working.

Even the file is not getting created with this code. Please suggest

Thanks,

Aamir

0
Jens Schwendemann Mar 10 at 12:10 PM
0

As said, I'm not an expert on command line. Please state if your PI server is running on UNIX, Linux or Windows.

Please have a look at "date" function if Linux / Unix. Not sure though how PI would interpret this. Using XPI Inspector might(!) help digging deeper into this.

Cheers

Jens

Share
10 |10000 characters needed characters left characters exceeded