Topic
3 replies Latest Post - ‏2013-11-04T15:28:35Z by VolkerFriedrich
renato.brito
renato.brito
2 Posts
ACCEPTED ANSWER

Pinned topic remove part of the file name - File Agent

‏2013-10-31T11:36:28Z |
Good Morning
 
Sorry for my bad english, I'm from Brazil and I have a lot of fluency in language.
 
I wonder if it is possible to remove characters from the file name by a script file agent.
 
example:
 
name_file01.txt is inside a variable &file
 
keep sending in
 
name_file.txt
 
I thank you for your attention.
  • VolkerFriedrich
    VolkerFriedrich
    132 Posts
    ACCEPTED ANSWER

    Re: remove part of the file name - File Agent

    ‏2013-11-04T10:16:47Z  in response to renato.brito

    You cannot remove characters from a file name as shown in your example.

    Maybe the following idea can help. Create a rule that will match name_file*.txt and keep sending as name_file.txt.

    • Match criteria: Name of the newly arrived file - Matches - *\name_file*.txt
    • Process Arguments: &file=name_file.txt
    • renato.brito
      renato.brito
      2 Posts
      ACCEPTED ANSWER

      Re: remove part of the file name - File Agent

      ‏2013-11-04T14:00:45Z  in response to VolkerFriedrich
      Hi 
       
      Yes I understand, but this way still does not solve the problem, why do I need to leave in an automated way. The way it's always you need to change the file name manually.
       
      I wanted to make sure there was no way to use the language of the FA in order to change the file name at runtime.
       
      Why our customer's file arrives in the directory that way. fileX01, fileY02, fileZ03 ... only his partner requires that you take the part numbers and the software that does this has no option to change.
       
      So confirming what you said is not how I work with the file name, then the best option is to make an application to correct the names of the files and send to the directory that is being monitored by the FA right?
      • VolkerFriedrich
        VolkerFriedrich
        132 Posts
        ACCEPTED ANSWER

        Re: remove part of the file name - File Agent

        ‏2013-11-04T15:28:35Z  in response to renato.brito

        Correct.

        You could

        (a) rename the file on the local side (PNODE) before you put it into the File Agent watch directory
        - or -
        (b) have the Connect:Direct process rename the file after a successful COPY step, for example by executing a batch file in an SNODE Run Task. Here is the simplified process logic:

        SENDFILE COPY
            FROM (FILE="&FN")
            TO (FILE="&FN" DISP=RPL)

         IF (SENDFILE EQ 0) THEN

         RUN TASK SNODE (PGM=Windows)
            SYSOPTS="pgm(convertFilename.cmd) args(~"&file~")"

        EIF

        Updated on 2013-11-04T15:31:09Z at 2013-11-04T15:31:09Z by VolkerFriedrich