File name extraction

Hi,
If have some data in the following form
/n abc.doc /n def.txt /n hgi.doc /n
If I want to display the file name between the newlines in the following way to the user:
abc.doc
def.doc
hgi.doc
How can I do it ??? A hint would be great.
thanks
@debug

StringTokenizer st=new StringTokenizer(yourstring,"/n");
while(st.hasMoreTokens())
S.O.P(st.nextToken());
}

Similar Messages

  • Is it possible to extract a PDF file into separate ones but using a specific file name that comes from the PDF page?

    Hello,
    I am unsure if this is possible but its worth asking.
    I have a PDF document that contains 56 pages.
    Each page has an 'Agreement Number' at the top left.
    I have managed to successfully extract the pages into separate documents (56 documents) but they are all named the same but page 1, page 2, page 3 etc..
    What i am trying to do is use these 'agreement numbers' in the extraction process so when they save i have 56 different files but they show the agreement number in the file name.
    i have looked into changing the actual page numbers on the page thumbnails to see if you can do it that was to no avail.
    any help would be much appreciated, or tell me i cant do it, at least i know ill be defeated.
    PS i have around 6 or 7 PDF files with 50+ pages so its a long boring task if i need to go and rename all these.
    Cheers
    Jez

    It would be possible in theory to do it with a folder-level script, provided the string you need is in exactly the same structural position on each page. You would use the doc.getPageNthWord() function to collect the string you want, then the doc.extractPages() function to save each page to a file.
    See the Acrobat SDK documentation for help with scripting. http://bit.ly/AXISDKH

  • Import From Folder: How to Extract the File Name in a Custom Column.

    Hello All
    Here´s what we´re trying to do:
    We have a folder with csv files named like this:
    Sales_2013-02-05.csv
    Sales_2013-02-04.csv
    Sales_2013-02-03.csv
    Sales_2013-02-02.csv
    Sales_2013-02-01.csv
    And in the csv files there are the sales columns but not the date column.
    So we want to extract the date from the file name.
    I´ve tried entering = Source[Name] in a custom column, but it adds a "LIST" link, and on a click on expand, it adds ALL file names from the folder in each row, instead of just the needed one.
    If we could get the proper file name in each row (from where they got extracted), we could split the column and get the date from there. But I don´t know how put the filename there properly.
    Can you help?

    This isn't entirely straightforward, but it's definitely possible. What you need to do is to apply all of your transforms to each individual file instead of the combined files. I do that as follows:
    1) Use Folder.Files as generated by the GUI to look at the list of my files.
    2) Pick one file and do all the transformations to it that I want to apply to all of the files. Sometimes, this just amounts to letting the autodetection figure out the column names and types.
    3) Go into the advanced editor and edit my code so that the transformations from step 2 are applied to all files. This involves creating a new function and then applying that function to the content in each row.
    4) Expand the tables created in step 3.
    As an example, I have some files with names that match the ones you suggested. After steps 1 + 2, my query looks like the following:
    let
        Source = Folder.Files("d:\testdata\files"),
        #"d:\testdata\files\_Sales_2013-02-01 csv" = Source{[#"Folder Path"="d:\testdata\files\",Name="Sales_2013-02-01.csv"]}[Content],
        #"Imported CSV" = Csv.Document(#"d:\testdata\files\_Sales_2013-02-01 csv",null,",",null,1252),
        #"First Row as Header" = Table.PromoteHeaders(#"Imported CSV"),
        #"Changed Type" = Table.TransformColumnTypes(#"First Row as Header",{{"One", Int64.Type}, {"Two", type text}, {"Three", type text}})
    in
        #"Changed Type"
    For step 3, I need to take steps 3-5 of my query and convert them into a function. As a check, I can apply that function to the same file that I chose in step 2. The result looks like this:
    let
        Source = Folder.Files("d:\testdata\files"),
        Loader = (file) =>
            let
                #"Imported CSV" = Csv.Document(file,null,",",null,1252),
                #"First Row as Header" = Table.PromoteHeaders(#"Imported CSV"),
                #"Changed Type" = Table.TransformColumnTypes(#"First Row as Header",{{"One", Int64.Type}, {"Two", type text}, {"Three", type text}})
            in
                #"Changed Type",
        #"d:\testdata\files\_Sales_2013-02-01 csv" = Source{[#"Folder Path"="d:\testdata\files\",Name="Sales_2013-02-01.csv"]}[Content],
        Loaded = Loader(#"d:\testdata\files\_Sales_2013-02-01 csv")
    in
        Loaded
    Now I apply the same function to all of the rows, transforming the existing "Content" column into a new value:
    let
        Source = Folder.Files("d:\testdata\files"),
        Loader = (file) =>
            let
                #"Imported CSV" = Csv.Document(file,null,",",null,1252),
                #"First Row as Header" = Table.PromoteHeaders(#"Imported CSV"),
                #"Changed Type" = Table.TransformColumnTypes(#"First Row as Header",{{"One", Int64.Type}, {"Two", type text}, {"Three", type text}})
            in
                #"Changed Type",
        Transformed = Table.TransformColumns(Source, {"Content", Loader})
    in
        Transformed
    Finally, I need to expand out the columns in the table, which I can do by clicking on the expand icon next to the Content column header. The resulting query looks like this:
    let
        Source = Folder.Files("d:\testdata\files"),
        Loader = (file) =>
            let
                #"Imported CSV" = Csv.Document(file,null,",",null,1252),
                #"First Row as Header" = Table.PromoteHeaders(#"Imported CSV"),
                #"Changed Type" = Table.TransformColumnTypes(#"First Row as Header",{{"One", Int64.Type}, {"Two", type text}, {"Three", type text}})
            in
                #"Changed Type",
        Transformed = Table.TransformColumns(Source, {"Content", Loader}),
        #"Expand Content" = Table.ExpandTableColumn(Transformed, "Content", {"One", "Two", "Three"}, {"Content.One", "Content.Two", "Content.Three"})
    in
        #"Expand Content"
    From here, you should be able to get to what you want.

  • How can I extract a file name / path from a local path variable in TestStand?

    I have local TestStand string variable, call it 'locals.path', that contains a path to a file including the file name (c:\inputs\input.txt). I need to be able to split up the path (c:\input) and the file name (input.txt) and save them into 2 local variables. What is the best way to do this?
    After reading through some of the other forums, it looks like there are some built-in functions that can accomplish this, but I am unable to find how to use them anywhere on the NI web site. One forum said to use the File I/O>Strip Path.file function. How is this called? Is this function in a DLL?
    I know that there are a number of DLLs that are installed with TestStand into the c:\windows\system32 directory. One forum made note of CVI_OpenFile / CVI_ReadFIle functions in the cvirt.dll that I used to solve a problem that I had in the past. The problem is that I had no idea that that these functions even existed and would have never known unless a similar question had been posted previously. Is there some place that these DLL function interfaces are defined or documented? Is there a function that can extract the file name out of a string for me?
    Thanks,
    Mike

    Hi,
    There sound like functions in say LabVIEW or CVI.
    I have attached a small example which may help. (I have not allowed for any error trapping, if say you dont find the file and cancel)
    Regards
    Ray Farmer
    Message Edited by Ray Farmer on 10-16-2006 10:04 PM
    Regards
    Ray Farmer
    Attachments:
    Sequence File1.seq ‏33 KB

  • I have a question about extracting pages.  When I do the function, adobe saves the individual files as " file name space page number ", so the files look like this "filename 1.pdf", "filename 2.pdf", "filename 3.pdf".  Without too many gory details, I a

    I have a question about extracting pages.  When I do the function, adobe saves the individual files as "<file name><space><page number>", so the files look like this "filename 1.pdf", "filename 2.pdf", "filename 3.pdf".  Without too many gory details, I am using excel to concatenate some data to dynamically build a hyperlink to these extraced files.  It casues me problems, however, for the space to be the the file name.  Is there any way to change the default behavoir of this function to perhaps use a dash or underscore instead of a space?

    No, you can't change the default naming scheme. You can do it yourself if you extract the pages using a script instead of using the built-in command.

  • Changing the file name n Flat file Extraction

    Hi,
    Currently i am using flat file extraction for my forecast data and i am sending the file through application server.
    I have created directory successfully and now everyday morning i receive a file thru FTP server with name 20060903.csv and this name is based on one field in my flat file data.  ex. /interface/asf/20060903.csv
    During mid off month we have cut off date, and this cut off date varies for each month. During this time file name changes in the FTP and a file with different name i.e 20061002.csv will be existing in the application server.
    Now in the infopackage i also need to set the deletion settings like if the file name is same delete the previous requests. I could achieve this if i could get the file name changed.
    Lets say if i am not chnaging the file name how do i set deletion condition, like it should not delete if the field(scenario) changes. ie from 20061002 to 20061101. I should have only one file for 20061002 and one file for 20061101 etc... If the scenario is same it should delete.
    Any one kindly advise. Very urgent and critical.
    Tks & regards,
    Bhuvana.

    Hi Bhunva,
    Try the following abap code in routine under External data tab in infopackage.
    data: begin of i_req occurs 0,
          rnr like RSICCONT-rnr,
          end of i_req.
    select * from RSICCONT UP TO 1 ROWS
                      where ICUBE  = <datatargetname>
                      order by TIMESTAMP descending.
      i_req-rnr = rsiccont-rnr .
      append i_req.
      clear i_req.
    endselect.
    loop at i_req.
      select single * from RSSELDONE where RNR eq i_req-rnr and
                                       filename = p_filename.
      if sy-subrc = 0.
        CALL FUNCTION 'RSSM_DELETE_REQUEST'
          EXPORTING
            REQUEST                    = i_req-rnr
            INFOCUBE                   = <datatargetname>
          EXCEPTIONS
            REQUEST_NOT_IN_CUBE        = 1
            INFOCUBE_NOT_FOUND         = 2
            REQUEST_ALREADY_AGGREGATED = 3
            REQUEST_ALREADY_COMDENSED  = 4
            NO_ENQUEUE_POSSIBLE        = 5
            OTHERS                     = 6.
        IF SY-SUBRC <> 0.
          MESSAGE ID sy-MSGID TYPE 'I' NUMBER sy-MSGNO
              WITH sy-MSGV1 sy-MSGV2 sy-MSGV3 sy-MSGV4.
        else.
          message i799(rsm1) with i_req-rnr 'deleted'.
        ENDIF.
    endif.
    let me know if you get any problem in this logic.
    regards,
    Raju

  • Extracting string from a file name

    Hello,
    I have a legacy (read: I didn't build it) SharePoint list  that includes some validation when uploading files that's giving me some trouble.
    Basically, our users are required to add files to a list in a certain filename format and based on the naming convention are approved/rejected and routed to the appropriate location.
    One of the validations looks at a section of the file name and compares it to a folder name in the library.
    For example, the file name format is XX_AAA_999_2014_05.xlsx and that matches on the folder name of /submissions/2014_05
    Currently the rule says look at the last 7 characters of the folder and the 7 characters starting at position 12 of the filename and make sure they match.
    The problem is the 999 in the example above is a sequential identifier to the project a file is associated with... e.g. they range from project 000 to project 999. We've now hit project 1000 so file being added for project 1000 (and beyond) fails because
    the starting position has shifted one spot. (Note: we have active 3 digit projects so I cannot simply change that to be position 13... not to mention what that does to my history).
    So, my task is to come up with something that can accomodate 3 or 4 digit numbers.
    I'm trying to stick as closely to the original setup so I don't mess up the history so I'm looking at other methods of getting to the same data in the string.  Another problem is that the file names include the extension and the extension can be 3 (pdf)
    or 4 (xlsx) characters long.
    I've tried this:  =LEFT([Source File Name],SEARCH(".",[Source File Name])-1)
    but that brings back everything in front of the period and I need just the 7 preceeding characters.  Is there a way to limit the number of chars a LEFT() function returns?
    In a nutshell, the 4 variations of file names are as follows of which I need to extract the
    bolded section.:
    ZZ_AAA_999_2014_05.xls
    ZZ_AAA_999_2014_05.xlsx
    ZZ_AAA_1000_2014_05.xls
    ZZ_AAA_1000_2014_05.xlsx
    Thanks!
    Kevin

    Hi,
    According to your description, you might want to retrieve the string “2014_05” from the file name.
    I would suggest you create a SharePoint Designer workflow and implement your logic of handling the filename.
    In SharePoint Designer 2010, there are already some useful utility workflow actions which can enable users to deal with the various requirements come from the business scenarios.
    For the string handling, you can consider to use the
    Utility Actions:
    http://msdn.microsoft.com/en-us/library/office/jj164026(v=office.15).aspx
    Another two links about creating SharePoint Designer workflow for your reference:
    http://office.microsoft.com/en-001/sharepoint-designer-help/introduction-to-designing-and-customizing-workflows-HA101859249.aspx
    http://www.codeproject.com/Tips/415107/Create-a-Workflow-using-SharePoint-Designer
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Patrick Liang
    TechNet Community Support

  • How do I bulk upload documents using PowerShell and extract metadata from file name?

    I have a requirement to upload a bunch of documents into a document library. Based on the content type, the rules of updating the metadata is different...the one giving me trouble is to extract the metadata from the file name. If I have a file name like
    "part1_part2_part3.pdf" how do I extract part1, part2, part3 and tag each document being uploaded into SharePoint, using PowerShell? I have searched and have not been able to find anything to get me started.
    Has anyone done this before? Or is there a blog I can take a look at? Thanks
     

    You will have to write a PS script encompassing this logic.
    Read files from the folder using
    Get-Item cmdlet
    Determine the content type based on the path or filename.
    Split the file name to extract the tag names.
    If the metadata fields in the content type is a managed metadata field, check whether the term exists and set it.
    Updating SharePoint Managed Metadata Columns
    with PowerShell
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • Changing name of directory created after source file is extracted

    This seems like it should not be a big problem, but I can't figure out how to fix it. I'm writing a PKGBUILD for a program called JAGS (http://calvin.iarc.fr/~martyn/software/jags/). When I use "pkgname = JAGS", the PKGBUILD works perfectly for my purposes, but in the spirit of providing public goods I thought I'd submit it to AUR, which requires the pkgname to be all lower caps. This little detail is causing me problems. (The non-working PKGBUILD is below, and becomes the working PKGBUILD if you switch out the pkgname.)
    The source file online is called JAGS-1.0.3.tar.gz. Fine, so I added "$pkgname-$pkgver.tar.gz::" to the beginning of the source url. However, when this file is extracted, it takes the name of the original source file (JAGS in all caps), and then when the build function tries to cd $pkgname-$pkgver it gives errors.
    How would you deal with this? Of course I can just change the cd command, but I prefer that the directory be consistent with the package name. Should I add the whole tarball to the noextract argument and include a different tar command in the build function?
    pkgname=jags
    pkgver=1.0.3
    pkgrel=1
    pkgdesc="Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation"
    arch=('x86_64')
    url="http://calvin.iarc.fr/~martyn/software/jags/"
    license=('GPL')
    makedepends=('gcc-fortran')
    source=($pkgname-$pkgver.tar.gz::http://calvin.iarc.fr/~martyn/software/jags/JAGS-1.0.3.tar.gz)
    md5sums=('fa94031290e23d47e26affc571f76e38')
    build () {
    cd "$srcdir/$pkgname-$pkgver"
    ./configure --prefix=/usr
    make
    make DESTDIR="$pkgdir/" install

    Change:
    cd "$srcdir/$pkgname-$pkgver"
    to:
    cd "$srcdir/JAGS-$pkgver"
    Edit: You may also avoid renaming the tarball on download since this doesn't serve any purpose.
    Last edited by foutrelis (2009-11-26 16:56:11)

  • Extracting text from a file name on export / import (Regular Expressions??)

    I’m not even sure if the publishing service, File Naming, in Lightroom supports Regular Expressions or not?? Basically I’m trying to extract the left portion of the file name ie: everything before the underscore “_”. When I import a file I rename the file to reflect the current Image sequence number and then append the date the photo was taken; a typical file is as follows “05625_2008-01-05.dng” on export I would like the new name to be only the sequence number in this case “05625.jpg”. Ideally I would then like to append the folder name that contains the file… “05625 - FolderName.jpg.
    I don’t want to go down the road of figuring out the correct syntax if regular expressions aren’t supported. Thanks in advance - CES

    Is the imported sequence number captured in meta data somewhere or is their somewhere that all of the available fields and there reference names can be found???
    Unfortunately not anywhere available to the user (but it's still stored in at least some filed I know off).
    By the way, why did you choose to put the suffix at the beginning of the name (1234_2010-08-13.jpg)? The common practice is to leave the suffix at the end. That will ensure the filenames will sort in chronological order by filename and you could have easily used the suffix when exporting files. You wouldn't have this problem now.

  • How can I extract metadata from file names?

    If I want to extract metadata from file names? How can I do that? I want to read through the file names and when I get to a certain character ("-"), I can take the string just before that character and store it in a column in SharePoint. Is this
    do-able through scripting? 

    If I want to extract metadata from file names? How can I do that? I want to read through the file names and when I get to a certain character ("-"), I can take the string just before that character and store it in a column in SharePoint.
    Is this do-able through scripting? 
    You should be able to leverage the split method.
    In PowerShell It would look like:
    # Gather the file name
    $file = "myawesome_filename-Month-Day-Year-Ect.doc"
    #split the file name by the "-" character
    $file = $file.split("-")
    # Use a foreach Loop to gather the individual items.
    foreach ($item in $file) {
    write-host $item
    #Outputmyawesome_filename
    Month
    Day
    Year
    Ect.doc
    # If you want to only grab the first item, you can do $file[0] <-- powershell starts counting with zero base.
    $file[0]
    #output
    myawesome_filename
    Entrepreneur, Strategic Technical Advisor, and Sr. Consulting Engineer - Strategic Services and Solutions Check out my book - Powershell 3.0 - WMI: http://amzn.to/1BnjOmo | Mastering PowerShell Coming in April 2015!

  • Extract file name for size gt 10M

    Hi
    I am writing a script to extract the file name whose size is greater than 10M. What I wrote is as follows:
    export LIST=`ls -ltr | awk '{print $5 ,$9}'`
    for SUBLIST in ${LIST}; do
    echo ${SUBLIST}
    export SUBLIST1A=`echo ${SUBLIST} | awk '{print $1}'`
    export SUBLIST1B=`echo ${SUBLIST} | awk '{print $2}'`
    echo ${SUBLIST1A}
    echo ${SUBLIST1B}
    ###### if [[ $SUBLIST1A -gt 10000000 ]]; then
    if ( '100000000' -gt '10000000' ); then
    #echo "KITCARSON File size \> 10M : $SUBLIST1B" | mailx -s "File Size Alert" $[email protected]
    echo "KITCARSON File size \> 10M : $SUBLIST1B" | mailx -s "File Size Alert" [email protected]
    fi
    done
    But this does not seem to be working. Can somebody help me with this.
    Any help would be appreciated.
    thanks

    you can use the find command to do the same thing..
    #find . -size +10000000c
    ./core.7.Z
    ./T111685-09.tar.Z
    ./eleven
    this will print out all files greater than 10MB in size.Check man pages for find.
    cheers
    -Dhruva

  • Need to extract only file name from path.........

    Hi All,
    I have a parameter.This calls the function
    "CALL FUNCTION 'F4_FILENAME' to get the file from C drive.
    After selecting the file the path is displayed in the Parameter field.
    My problem is I need to extract only file name from the path.Please advice.
    Example : Prameter  id    C:\folder\file.xls  
    I shd extract only file.xls from the path.Please advice.

    Hi,
    Use the below logic:
    data: begin of itab,
               val    type  char20,
            end of itab.
    SPLIT  l_f_path  AT  '\'  INTO  TABLE itab.
    The last record of the internal table holds the file name.
    describe table itab lines l_f_lines.
    read itab index l_f_lines.
    l_f_filaname = itab-val.
    Hope this helps u.

  • Extracting file name text

    I have written a script that automatically sends out via FTP application Transmit, any new file that enters into a hot folder
    what I need now is..
    a script that writes information on a textedit document
    I need
    •open up a textedit document
    then prints
    •the file name "theFile"
    •time and date
    •then saves the file on the desktop
    THEN when another file is sent, the script adds that the next file done info to the text file thus creating a list of completed tasks

    File Name, Time, and Date format -
    on adding folder items to this_folder after receiving these_items
    -- Create or open, and edit, 'Folder_Contents.txt' on the 'Desktop'.
    set FILE_REF to open for access file (((path to desktop folder from user domain) as string) & "Folder_Contents.txt") with write permission
    repeat with i in these_items
    tell application "Finder" to set file_Name to ((displayed name of i) as string)
    -- Writes the string at the end of 'Folder_Contents.txt'. (File Name, Time, and Date format)
    write (file_Name & " " & (do shell script ("date +%H.%M.%S' '%d.%m.%Y")) & return) to FILE_REF starting at eof
    end repeat
    close access FILE_REF -- Close 'Folder_Contents.txt'.
    end adding folder items to
    ... or. Date, Time, and File Name format -
    on adding folder items to this_folder after receiving these_items
    -- Create or open, and edit, 'Folder_Contents.txt' on the 'Desktop'.
    set FILE_REF to open for access file (((path to desktop folder from user domain) as string) & "Folder_Contents.txt") with write permission
    repeat with i in these_items
    tell application "Finder" to set file_Name to ((displayed name of i) as string) -- Extract file name from files' full path.
    -- Writes the string at the end of 'Folder_Contents.txt'. (Date, Time, and File Name format)
    write ((do shell script ("date +%d.%m.%Y' '%H.%M.%S")) & " " & file_Name & return) to FILE_REF starting at eof
    end repeat
    close access FILE_REF -- Close 'Folder_Contents.txt'.
    end adding folder items to
      Mac OS X (10.4.4)  

  • Extracting Pages and naming file names of pdfs

    I need to be able to extract pages from a large file to create seperate pdf documents for each page. When I do this the file name for each page is for instance "Medical Records 1.pdf"; "Medical Records 2.pdf".... Medical Records 11.pdf"
    Here is the problem. When I go to review them in order the page (document) that is numbered 2 will not be after "1" but rather just before "20" and "3" is out of order and just before "30". When the number of pages is 600 plus this is a problem. This would not happen if there was a leading "0" before the "2" , "3", "30" etc. This happens with single digits and double digits as well since the page numbers are in the hundreds.
    Any ideas on how to correct this issue? Thanks in advance.

    This sounds like an issue with the sort order display in Windows Explorer. If you use the File > Open dialog in Acrobat the files should display correctly.
    If you're previewing the PDFs in Windows Explorer try clicking the Name button underneath the toolbar to change the sort order from ascending to descending, then a single click again should display them correctly.

Maybe you are looking for

  • HP Laptop Power Cord Safety Recall and Replacemen​t

    Some power cords for HP and Compaq and mini notebook computers sold from September 2010 through June 2012 may be part of voluntary recall and replacement program launched on August 26, 2014. The impacted power cords have the potential to overheat, po

  • My WRT54G v5 router loses internet connection frequently

    My WRT54G v5 router loses internet connection frequently. Sometimes occurs when you enter a web or sometimes every few minutes, but without a pattern. I have W XP Pro with SP3 and I have a pc wired to the router and sometimes 2 notebook with Wi-Fi. W

  • How do you restore a depleted batte

    I was going through the trouble shooting on the site and it seems like the problem with my player falls in that category as it doesnt want to recharge no matter what?i do. The site says "Restoring the power to depleted battery" but only gives the sym

  • IMP: How to define own methods for pow(), sqrt() etc?

    HI ALL! We designed midlet to run on a mobile phone. We have some additional trignometrical classes to integerate with the midlet. But we got astonished when we didn't find any trignometrical function in MIDP1.0 & CLDC1.0. It is now is a great panic

  • Node id problem

    Hi this is my problem.i have a jtree which a user adds nodes to and from.now, when a duplicate is added to the tree, i assign a unique index to the end of the defaultmutabletreenode, for example, if i have "book" and i input another entry called"book