Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Mar 18 at 06:52 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 09 at 04:48 PM

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

    cp %F "/targetdirectory/test1$(date +'%Y%m%d%H%M%S')"
    Add comment
    10|10000 characters needed 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

  • Mar 10 at 12:10 PM

    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

    Add comment
    10|10000 characters needed characters exceeded