HowTo Rename file based on message content?

Hi All,
Newbie here.
I have an message which i'm pushing out to a file via a File eWay.
I need to name\rename the file based on the ID of the message.
What is the best way to do this?
Thanks,
Ken

I'm not aware of a way to do this via the File eWay, which is very limited in functionality. Of course, you could do it with standard java.io but that isn't very Java EE. So, I typically use the Batch eWay (Batch Local File) where more robust capabilities such as this are quite easy using the dynamic configuration features.

Similar Messages

  • Sorting incoming files based on payload content

    Hi,
      I have a file>XI-> FILE scenario...I need to sort the incoming file based on payload content...But my understanding is in XI each line item would be processed one at a time...Is it possible to sort the entire file before beginning to process???
    -Ken

    Hi Ken,
    you can try to create generic content sorting with java mapping:
    /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping
    Regards,
    michal

  • Help renaming pdf files based on internal content

    I work for a company that has thousands of E-tickets coming in daily, weekly, monthly, etc..
    These tickets come in bafhakfbaifh.pdf and we have to manually rename them or print them all out and then sort through them and put them in order.
    What I would like to do is:
    1. Split any pdf's that have more than one page or "ticket" in my case. I know how to do this with automator easily, but I'd love to keep it all in one program.
    2. Search the file for Event Name (i.e. Madonna)
    3. Search the file for Date of event (August 12, 2012)
    4. Search the file for Section, Row, Seat (124 3 12)
    5. Rename the file based on content found (Madonna August 12 2012 124 3 12.pdf)
    6. Move from original download folder to organized folders based on artist/team.
    7. Automatically print in alphabetical or some sort of designated order.
    Any help is muchly appreciated. So far, I found a PC program called A-PDF rename, but it is not automated enough to be practical. Hazel is awesome at OCRing the pdf and moving from folder to folder, but does not do enough.
    Any help is muchly appreciated.
    Thank you.

    You're looking for a PDF Parser or PDF miner tool (PDFminer) as a starting framework, and you'll almost certainly be writing custom code around that as parsing a text file that's effectively free-form and originating from multiple different sources almost always (always?) involves writing customized processing code and an on-going series of tweaks as the suppliers of the PDF change their ticket formats.  (Even apparently-simple details such as the time and date formats, for instance, can vary by geography and language and by supplier, and can derail common processing.)
    In some cases that I can envision, it'd be entirely possible that the data you're after is actually located in an embedded image and not in text that can be parsed.
    The best approach is to get folks to send you JSON or XML or some other format intended for interchange, and avoid the whole mess that is parsing or mining a printer-oriented format.
    The other obvious option is to use something like Amazon's Mechanical Turk or some other explicitly outsourced help.  Depending on how often the formats change and how many of these PDF files you're dealing with and how varied the formats are, sometimes throwing staff at the problem can be the most cost-effective approach.

  • Powershell to rename file based on output

    Good Afternoon
    I was wondering if someone could assist with the below
    1. We currently have a system in place whereby a document is scanned onto the system as an image and this is saved in a central location folder
    2. I then run tesseract within powershell on this location folder, which is a program that can extract the image to txt file and this converts the image to a txt file and saves in the same location with the same name
    3. What i would like to do is for powershell to then search the extracted txt file and look for a particular regexpression (which i have) and to then rename the original file from point 1 to the output
    Is the above possible at all
    This is what i have so far, what this seems to do is look in my ocr folder and run tesseract and the output txt files end up in the same folder
    $TargetFolder1 = “c:\ocr\test\file.txt”
    $regex = '[0-9]{5,6}[\.][0-9]{0,1}'
    $result = out-file ("c:\OCR\Match\""imtest" + ".txt")
    select-string -Path $Targetfolder1 -list -Pattern $regex | % { $_.Matches } | % { $_.Value } > $_result
    cd "C:\Program Files (x86)\Tesseract-OCR"
    Apologies of it seems confusing
    Barrie

    Hi
    Many thanks for the info so far, much appreciated
    I have read around on the Microsoft Powershell learning site but becoming slightly confused with some more piping
    I previously mentioned that the tesseract program converts the ocr scanned tif file into a text file - Is it possible instead to have this output to a variable of some sort and then for my reg expression carry out the search in the variable and
    then rename the tif file based on the result of the regexpression
    Previously i have ran tesseract on a tif file via powershell which in turn produces a text file of the document in the file location
    I think it would be best if i ran tesseract on the tif file, then for powershell to export the results somewhere and the reg expression query can be run and the final result will rename the original tif file with the output of the reg expression
    Hope this makes sense and many thanks for help so far
    Regards
    Barrie

  • How can I automatically rename files based on an excel doc?

    I am a scientist and recieve data files from some of my experiments with arbitrary, computer-generated names. For example, if I perform an experiment with four samples, which I name Sample1, Sample2, Sample3, and Sample4, I get back 4 data files named J30935D05.ab1, J30935E05.ab1, J30935F05.ab1 and J30935G05.ab1 along with an Excel doc that lists my names for the samples (sample1, sample 2, etc.) in one column and the computer-generated names for their corresponding files (J30935D05.ab1, J30935E05.ab1, etc.) next to them in another. Therefore, I must open the Excel file and look up which file corresponds to which sample before I can begin processsing my data. Usually these experiments involve a large enough number of samples (70-100 or so) such that looking everything up in the Excel doc gets very tedious and is quite time-consuming. Is there any way to create an automator workflow, applescript, or some other solution to rename these files based on the Excel doc? To clarify, I would like an automator workflow that would take a folder of arbitrarily named files, look up the names I have for the samples in the Excel doc, and rename the files accordingly. In the example, my folder containing files J30935D05.ab1, J30935E05.ab1, J30935F05.ab1 and J30935G05.ab1 would be turned into a folder containing the files renamed as Sample1.ab1, Sample2.ab1, Sample3.ab1, and Sample4.ab1. This example is a bit simplified, however, and trying a simple trick of just systematically renaming files within the folder would not work--both the original and the new file names must be looked up in the Excel doc, as these change dramatically from experiment to experiment. I would also need to maintain the file extension on each file after being renamed. Any help would be greatly appreciated!!

    Try the freeware utility Renamer4Mac (VersionTracker or MacUpdate).
    Why reward points?(Quoted from Discussions Terms of Use.)
    The reward system helps to increase community participation. When a community member gives you (or another member) a reward for providing helpful advice or a solution to their question, your accumulated points will increase your status level within the community.
    Members may reward you with 5 points if they deem that your reply is helpful and 10 points if you post a solution to their issue. Likewise, when you mark a reply as Helpful or Solved in your own created topic, you will be awarding the respondent with the same point values.

  • Priorization based on message content

    Hello Everybody!!
    I have a RFC -> ccBPM1 -> ccBPM2 --> RFC scenario! 
    The RFC message sent to PI (ccBPM1) has to be processed before or after the other messages based on the content of one of its fields. Since the RFC messages are from the same type (same RFC) they all are received in the same queue (WS****01). Is there any way I can do priorization with messages of the same type?
    tks in advance
    Julio

    Hi,
    >>>Is there any way I can do priorization with messages of the same type?
    in your case you don't want prioritization - you need EOIO mode
    and you need to send messages in correct order from ERP
    try using abap proxy or IDOC instead of RFC (so you can do EOIO)
    and remove the BPM in the middle as EOIO cannot be maintained with a BPM
    but if you want answer to this question only:
    >>>Is there any way I can do priorization with messages of the same type?
    then it's no not in 7.1
    Regards,
    Michal Krawczyk

  • Renaming files based on sequence

    I have a set of 3 images for an MxN pixels of certain scan.
    I have developed a code that does some image processing and renames the files as pulse-1, pulse-2 and background-1. This is for 1 pixel. Right now I can do this to only the three images that relates to One pixel that I used for testing.
    In futures I will be having MxN images, which means MxN pixels and I have MxNx3 images, how can I sequentially rename the files based on which pixel it corresponds to ? for ex: Pixel-1_Pulse1, Pixel-1_Pulse2 and Pixel-1_Background.
    The developed code for 3 images is attached.
    Abhilash S Nair
    Research Assistant @ Photonic Devices and Systems lab
    [ LabView professional Development System - Version 11.0 - 32-bit ]
    LabView Gear:
    1. NI PXI-7951R & NI 5761
    2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021
    OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
    CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
    MEMORY - [ 16.0 GB RAM ]
    GPU - [ NVIDIA GeForce GT 530 ]
    Attachments:
    Image intensity - DEV-9.vi ‏38 KB

    Well, the tools are "strip path", "build path", and "get file extension". The rest are simple string operations on the filename.
    Sorry, it is not clear what exactly you are trying to do. Is each pixel a seperate image file? You seem to list all BMPs in a folder, but then only look at three files.
    Can you show an example file list and what kind of output you expect from it?
    (In the meantime, you really should do a few more tutorials. learn about autoindexing (first loop). Also don't convert the path to a string only to convert it back to what it was a few nanoseconds later. The "array to cluster...unbundle dance" is just silly. Simply use index array resized to three output. See attached).)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Image intensity - DEV-9-MOD.vi ‏29 KB

  • Need a script to do the following... rename files based on folder name...

    Hi. Macophile just starting to tread the waters of Applescript, trying to use Automator but don't think it will do what I need.
    I have many images stored with-in folders that I would like to extrapolate a given number of characters from the folder name and Add Text to the files within those given folders.
    Basically...
    Folder name is C00100_Descriptive
    Files within folder are just Descriptive_01, Descriptive_02
    Would like to make all files within a given folder take the first 7 characters from the folder and Add that text to all files and files within subfolders of that folder to make the resulting files shown as...
    C00100Descriptive01
    C00100Descriptive02
    Along with this I would also like to incorporate into the script, an added step to create Thumbnail jpegs of the image files in a Subfolder under C00100_Descriptive folder.
    I can see how to do that in automator but not specifying parameters such as taking a certain number of characters from the folder the file resides in and adding that selected text to the files.
    Ideally I would like a droplet or something that I could take a bunch of folders and drop them on the droplet to perform these actions.
    Any advice, help or guidance would be really helpful! Thanks in advance.

    Awesome, you're quite welcome, glad to hear it worked for ya!! Here's another version of the script that will rename the thumb files as jpg...
    <pre style="width:630px;height:auto;overflow-x:auto;overflow-y:hidden;"
    title="Copy this code and paste it into your Script Editor application.">on run
    set theItems to choose folder with multiple selections allowed
    open (theItems)
    end run
    on open (itemList)
    repeat with anItem in itemList
    set theInfo to info for anItem
    --VERIFY THAT THE OPENED ITEM IS A FOLDER
    if folder of theInfo and not package folder of theInfo then
    --SET PATH TO THE FOLDER
    set theFolder to POSIX path of anItem
    --GET FIRST PART OF FOLDER NAME
    set folderNameStart to do shell script "echo " & ¬
    quoted form of (name of theInfo) & "|awk -F'_' '{print $1}'"
    --GET ALL FILE NAMES
    set fileList to list folder anItem without invisibles
    --PROCEED IF FOLDER NOT EMPTY
    if fileList is not {} then
    --SET PATH TO THUMBNAIL FOLDER
    set thumbFolder to theFolder & "_thumbs/"
    --CREATE FOLDER IF IT DOESN'T ALREADY EXIST
    try
    do shell script "mkdir " & quoted form of thumbFolder
    end try
    --PROCESS FILES
    repeat with fileName in fileList
    --SET PATH TO CURRENT FILE
    set oldFile to theFolder & fileName
    --PROCEED IF FILE IS NOT A FOLDER
    set oldFileInfo to info for POSIX file oldFile
    if not folder of oldFileInfo then
    --SET NEW FILE AND THUMB FILE PATHS
    set newFileName to folderNameStart & "_" & fileName
    set newFile to theFolder & newFileName
    set theExt to name extension of oldFileInfo
    set thumbName to text 1 through -((length of theExt) + 1) of newFileName & "jpg"
    set thumbFile to thumbFolder & "thumb_" & thumbName
    --RENAME FILE
    do shell script "mv " & quoted form of oldFile & space & ¬
    quoted form of newFile
    --CREATE THUMBNAIL
    --REPLACE '128' WITH MAX HEIGHT OR WIDTH OF THUMB
    try
    do shell script "sips -s format jpeg -s dpiHeight 72 -s dpiWidth 72 -Z 128 " & ¬
    quoted form of newFile & " --out " & quoted form of thumbFile
    end try
    end if
    end repeat
    end if
    end if
    end repeat
    end open</pre>

  • Is there a way to rename files based on ID3 tags? Or, is it possi

    to move the files to my computer in another manner that will name them correctly? I couldn't find an option in the Creative Mediasouce program that would allow me to do this.
    I have most of my music files on my desktop pc, but want to move them to my laptop. I can use Nomad Explorer to pull them onto my laptop and they retain the id3 tag info, but are simply named by the title of the song. This makes it so that the songs are in alphabetical order in the new folder... I would rather not have to rename them adding a track number to each one as I will be transferring many files.
    Thank you very much!

    Well the ID3 tags are fine, as they were correct on the Zen Touch. My problem is just that when you drag-and-drop them from the player to the desktop of the computer, the file name given is only the title of the song (i.e. not track or artist or ablum info.). If there was a way to do it, I would like to change this 'track only name' into at least a 'track number - track name' so that the files are in the correct order for the album in the folder. I thought that this would be easy because the information is already stored in each track's ID3 tag, but I can't figure out how to use this to my advantage. Thanks for your help and sorry if this is confusing.

  • Auto sort incoming email based on message content and subject

    I am trying to do what it says above. I have created a smart mailbox and that will put on copy of the message in the mailbox and one in my inbox. How can I do it so it will be automatically added to that mailbox instead of my inbox?
    Thanks,
    Daniel

    don't use a smart mailbox for this. a smart mailbox is not a real mailbox. it's a saved search and doesn't move messages anywhere. make a regular mailbox and make a mail rule that moves incoming messages to that mailbox based on criteria you want.

  • Apple Script to rename files based on a style

    Hi I want to rename many files so they can uploaded to my website.
    In order for them to be uploaded they must be formatted in the following way.
    Firstname=Lastname=lab=summary
    I would input the firstname, lastname and summary for each file as that info is unique. Every file name's style will be the same. the first letter capiatlized in Firstname and Lastname and "lab" in non caps. there is also a "=" between all the words, no spaces.
    Is it possible to make an applescript program where I can drop the files in to the program and have a form open asking me to complete the FIrstname, Lastname and SUmmary fields while filling in the rest?
    Thanks in advance for any help.

    I'm confused about the details of the request.  can you describe the process more clearly? 

  • How can I rename files based on their ID3 tags?

    For example I would like to rename the files in a particular folder to have the format <track number> - <track name>.mp3
    I'd rather not used third party software to do this.

    For example I would like to rename the files in a particular folder to have the format <track number> - <track name>.mp3
    I'd rather not used third party software to do this.

  • SAP PI 7.3.1 File Adapter - Select file based on content

    Hi all,
    I have a scenario where I need to process a file differently based on the content within the payload.
    For example a file called File_IS,xml is sent to a folder that PI is polling. Within this file is a field <TYPE> which I want to use to determine whether the file should be used  . I have two mapping scenarios that each have a file sender communication channel polling for the same file name "File_IS.xml" .  This is because a message will come from a 3rd party with the same file name but the content can be different meaning different mapping scenarios are required.  IF Com_Channel_1 sees the File I only want it to be picked up if say <TYPE> = 'A' - if not then Com_Channel_1 should do nothing with this file.  Similarly Com_Channel_2 should only use the file if <Type> = 'B'. 
    Scenario:
    File_IS.xml       -> File sender 1  -> <TYPE> = 'A'  - Pick up file - do mapping - archive.  <TYPE> <> 'A' - do nothing and leave file in folder
                          ->  File sender 2  -> <TYPE> = 'B'  - Pick up file - do mapping - archive.  <TYPE> <> 'B' - do nothing and leave file in folder
    Is the above possible at all ?
    Thanks for your time.
    Best Regards.
    Gary

    Hello,
    In case content of input files are different (for both the scenarios) even then also u can use one file sender channel. Check below approach:
    Interface Determination condition
    Thanks
    Amit Srivastava

  • Merge files...... pick file dynamically Based on your content

    Hi All,
    In my current scenario I have 2 dependent sources (Proxy and File system) from which data is being sent to a common target service. The sources are dependent on Proxy/ECC to File System. Please let me know how I need to pick the file from File system because lot of files are there in File System. Based on my ECC/Proxy message details on field of ABN, according ABN number I need to be pick the file from the File system but I have lot of files in File system. Please let me know how to pick multiple files from one correct file based on my first file message.
    After that picking the files I need merge the two messages and send to target file system.
    Using fork I can merge files, no issues. But here problem to pick file dynamically Based on content .
    Please provide your input......
    Regards,
    Ramesh

    Hi Ramesh Sir,
    You can go for JAVA Type Message Mapping.
    ECC - >  JAVA BASED MESSAGE MAPPING ( HERE WE WILL PERFORM FILE LOOKUP) - > RECEIVER .
    Is This approach sounds fisible to you ?
    Please provide Sender DataType XML / Receiver DataType XML + any 1 csv file in which lookup has to perform.
    and this approach is only possible , if your Flat file is on FTP Server which is on the same network.
    Regards
    Prabhat Sharma.

  • Duplicate checking based on the content of the incoming file

    Hi,
    We have a requirement where in we have to check whether a file has been duplicated or not based on the contents of an incoming file.The threads which I have seen in SDN deal with the duplicate checking based on the filename of the incoming file.
    The incoming file has the following structure :
    Recordset                                     Occurance-1
           |....... Idoc                              Occurance 1...unbounded
                       |...... segment             Occurance 1
    We are required to make a check based on certain fields which occur in the segment.There are about 4 fields which we will have to take from the incoming file and carry out the check.These 4 fields exist in different segments.We will have to update a ztable with these 4 fields and then perform an rfc lookup to check for the contents of the incoming files with this table,and reject or process the file based on whether the entries exist in the table or not.
    Please let me know if there is any way this can be achieved.
    Appreciate if anyone could help me on this.
    Thanks and Regards,
    Induja

    SAP PI 7.1 Mapping Enhancements Series: Graphical Support for JDBC and RFC Lookups
    Use this crazy piece for any RFC Mapping Lookups!
    The specified item was not found.
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5877---- [original link is broken] [original link is broken] [original link is broken]
    Imp
    SAP NetWeaver Process Integration 7.1: Mapping Enhancements Blog Series
    SAP PI 7.1 Mapping Enhancements Series: Mapping Enhancements Demo
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    How to check JDBC SQL Query Syntax and verify the query results inside a User Defined Function of the  Lookup API
    The specified item was not found.
    The specified item was not found.
    Making CSV File Lookup Possible In SAP XI !!!
    SAP PI 7.1 Mapping Enhancements Series: Parameterized Message Mappings
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1888-----Imp [original link is broken] [original link is broken] [original link is broken]
    Triggering XI Alerts from a User Defined Function
    Aspirant to learn SAP XI...You won the Jackpot if you read this!-Part II

Maybe you are looking for