Getting File name without the suffix

If I have a file name myfile.java
Is there a function where I can get it to be just myfile without the .java at the end?

public static String getBaseName (String filename) {
     filename = filename.substring (0, filename.lastIndexOf ("."));
     return filename;
public static String getBaseName (File file) {
     String filename = file.getName ();
     return getBaseName (filename);

Similar Messages

  • Get File name of the inbound file during mapping

    Scenario: to read the file name of the inbound file (which has date required for the mapping) during runtime.
    The requirement is to read the date of the inbound file (passed to the XI pipline by the file adapter) and populate the same in the outbound mapping structure.
    Any idea about how to do this?
    (I went through few options of using java.util.map. not successful yet)

    Hi Anand,
    I posted the same question a time ago, without any help....
    Can I find out the full filename of input file in message mapping?
    Posted: Nov 23, 2004 1:00 PM
    I have in XI 2.0 the following scenario :
    In the inbound fileadapter I read my input file. The filename of the input file is part fixed, part variable (Like INDATA01.txt, INDATA03.txt, etc).
    So in my Adapterconfiguration, I specify the filename with a wildcard (INDATA*.txt).
    What I now want to do, is in my Message Mapping use the full filename , so I can do something different for every filenumber. Is there a way where I can get the full filename available in my message mapping (I did not find the filename in the XML in the message trace).

  • How to get file name of the form attachment?

    Hi,
    is there anybody who is able to help me with the following problem???
    I started my process from Workspace ES and as a first step I attached one locale file (IMG.JPG or IMG.TIF e.g.) as a form attachment. I used "Attachments" bookmark in the Workspace ES.
    I need to get file name of attached file in the process!!!
    I tried to use "getTaskAttachments" component to get file name of form attachment but without success. This component successfully obtained attached file an stored it in the variable (type list, subtype document) but didn't produce all file attribute informations such as basename or Content Type:
    Is there some possibility to obtain file name (including file extension) by using "standard" tools and components of ALC?
    Thanks for your suggestions.

    Hi LekomDev,
    I faced the same situation some time back and this is what I know.
    Based on the file type few of the attributes will or will not be populated. (This is what the official documentation says about Document attributes)
    The file name that you are looking for would mostly be in 'name' attribute of Document object. The 'wsfilename' attribute is the atrribute which gets used to show the file name into Attachments tab of the workspace.
    So, if you are just interested in knowing the filenames then 'name' attribute is the place that you are looking for.
    But if you are trying to solve an issue in which Attachments against a Task isn't showing the filenames properly then you would need to copy the 'name' attribute value into 'wsfilename' attribute and then the Attachmetns against a Task would have the correct names.
    Tip: Use the Record and Playback option of the workbench to inspect the Document variable and you would see all of the values for a Document variable at desired step in your orchestration.
    hope this helps,
    cheers,
    Parth Pandya
    Blog: http://livecyclekarma.wordpress.com

  • File-2-Proxy: Get file name in the inbound proxy?

    Hi,
    I need to know the file name in the inbound proxy. After a search I found that's possible mapping the file name to the target structure as it's explained in that link: [http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417200)ID1731350750DB00274596951164745615End?blog=/pub/wlg/2664]
    But I need to know if there is another way to access the file name in the inbound proxy without modifying the mapping.
    Thanks.

    this is possible by a dynamic configuration (there is no other easy way)
    some references -
    http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417500)ID1159980350DB00296046510040545862End?blog=/pub/wlg/13704
    the idea is to get the file name in runtime using the dynamic conf code and poulating it to any field that will be part of the proxy message

  • How to get file name on the base of extension

    hi
    reply me
    how to get the filename on the base of extension from the
    current directory......
    for example
    i create file with the "igg" extension and save in the folder
    where the exe file of director save....
    i want when exe run then exe file read filename of the
    define( "igg" ) extension with out path just name of the file with
    igg extension
    tel me how
    regards
    farhana khan

    Here's a solution that requires no xtras:
    on GetFilesWithExtension(aFolderPath, aExtension)
    -- INPUT: <aFolderPath> should be a valid string
    folder path
    -- <aExtension> may be a string file extension,
    without the
    -- dot. For example: "txt" or "igg"
    -- OUTPUT: Returns an error symbol or a linear list of file
    names
    -- in the given folder. If an extension is given, only
    -- files with the given extension will be listed. If not,
    -- all files and folders will be listed.
    vFileList = []
    if not stringP(aFolderPath) then
    return #stringPathExpected
    end if
    vIgnoreExtension = not stringP(aExtension)
    vDelimiter = the itemDelimiter
    the itemDelimiter = "."
    n = 0
    repeat while TRUE
    n = n + 1
    vFileName = getNthFileNameInFolder(aFolderPath, n)
    if vFileName = "" then
    exit repeat
    end if
    if vIgnoreExtension then
    vFileList.append(vFileName)
    else if the last item of vFileName = aExtension then
    vFileList.append(vFileName)
    end if
    end repeat
    the itemDelimiter = vDelimiter
    return vFileList
    end GetFilesWithExtension
    You can also use
    Buddy API's baFileList,
    which allows you to do wildcard searching.

  • Getting file name without adding asset

    Here's the set up-
    I use Watch Folders to compress videos for DVD, and I don't want to add the original files as assets. However, I want part of the watcher to be a script response that creates a text file with the same name as the original file. I haven't been able to pass the file name as a parameter- it keeps passing the MetaData field name. I've tried File Name and Title (I used quotes and brackets- can't show that on here, it makes it into links).
    I'm guessing I'm either using the wrong metadata field or this is impossible, because there is no metadata.
    Message was edited by: jamesnw

    I thought I had a solution for you, but upon testing it I discovered an unfortunate reality with the way FCSvr reports job status.
    You can subscribe to jobs and have that subscription feed the values of the job's fields to a script. The jobs don't track elapsed time, but they do stamp time for \[Updated] at the creation of the job, during the job, and at the close of the job.
    I tested this by creating one email response that will send me an email with the timestamp value of \[Updated] and a subject line of \[Job ID] \[Status] to tell them apart. I made two subscriptions, one that would fire upon the creation of a job that executes the response, and one that would fire on the modification of a job filtered for a status of "DONE".
    The problem is, the \[Updated] timestamp does not ever change in the metadata, it just gets updated in the GUI separately. More digging found the same is true for the \[Progress] field.
    You could have had two scripts, one that writes a timestamp to a file at the creation of a job with the first subscription that is filtered for the kind of thing you bill for based on whatever job field values, and another that finds the difference with the end timestamp at the close with the second subscription that is filtered for the kind of thing you bill for based on whatever job field values plus a \[Status] that equals "DONE". There would be a margin of error of a few seconds, but that just means you could round your billing up to the next minute.
    But alas, the job metadata never updates beyond the first values. In fact, if you open a job from the queue after it completes, the timestamp reverts to the initial value.
    Maybe you could have the script write a timestamp itself when it runs rather than trying to pull one from the job's metadata...

  • Can one lift a file-name without the file.extension in javascript

    I suspect this matter may have come up before but I could not find a thread on it ...
    Anyway: If I grab a filename for later use with
    var thedoc = app.activeDocument
    var docName = thedoc.name
    it picks up the original file-extension too.
    Is there a way to avoid this or to »substract« the extension later on?
    What I want to use that for is for saving multiple flattened CMYK-files from a layered RGB-psd-file into the same folder as the psd-file and appending a letter-combination to signify what printing-conditions they were generated for.
    As Im plenty ignorant in Scripting-matters any help would be appreciated.

    Here I go again:
    Originally I thought I would combine Actions and Scripts into a Droplet but then I got to thinking one Script containing all the operations would be neater.
    However I cant figure out how to write the Color Conversion of the RGB-files to CMYK into the Script.
    In »convertProfile« how do I address the ICC-Profiles and the Intent?
    Once again help would be appreciated, as I simply cant seem to figure it out from the Adobe-documentation on Javascript or a web-search.

  • Getting the swf file name of the module

    i have a parent application and it loads a module xyz.swf.
    however, i don't know the name of the module the parent application is loading.
    is there a way i can get the module's swf file name in the module code without knowing it beforehand?
    thanks

    Hi All,
    Iam able to do this by checking the Option ASMA in only sender adapter itself
    Regards
    Bopanna

  • GET FULL URL without the file

    Hi,
    I need to get the
    http://www.mysite.com/images/
    without coding it in so I can use it on multiple sites without
    re-coding. Basically it is an email systems where I want to include
    an email header and footer. In order for this to work the images
    need to have full paths to the images on the server. I have tried
    <cfset mypath = "
    http://#cgi.server_name##cgi.script_name#
    ">
    This returns
    http://localhost/clients/broker2/layout/siteadmin/email/email_news.cfm
    wich is good except the file name at the end.
    So I guess my question is - How do you take off the filename?
    I want this to work on different pages without re-coding.
    How do I take out just the filename ( anything after the last

    That works,
    But while I was waiting for an answer I came up with
    <cfset myPath = replace(GetDirectoryFromPath("
    http://"&cgi.server_name&
    cgi.path_info),"\","")>
    Both seem to work

  • Previously Firefox would show a number at the end of the file name (renaming the file by adding a number) showing that I had already downloaded a file at least once before. Recently that isn't happening. How do I get that feature back?

    When downloading, previously Firefox would show a number at the end of the file name (renaming the file by adding a number) showing that I had already downloaded a file at least once. Now that isn't happening. How do I get that feature back?

    When downloading, previously Firefox would show a number at the end of the file name (renaming the file by adding a number) showing that I had already downloaded a file at least once. Now that isn't happening. How do I get that feature back?

  • Can you get the file name of the current executing TSQL script?

    Can you get the file name of the current executing TSQL script? I wrote entries to a generic log file and would like to include the script name.

    Okay, So What you can do is
    1. Read get the version from your  database and redirect it to a text file(SQLCMD outout can be directed to text file using -o option or windows redirection operator >)
    2. Now you can read this value from the text file either inside a batch file or a powershell script and decide what operations you can do. 
    Satheesh
    My Blog |
    How to ask questions in technical forum

  • Get a font's file name from the font's postscript name (on Windows)

    I am trying to obtain the the font file name when the only information I have is the font's 'postscript' name. (Emphasis: the font's name is postscript and not the font).
    For example I have the following postscript name: TimesNewRomanPSMT.
    The real name that is saved in the registry is: Times New Roman (TrueType).
    Is there any way of obtaining that name from the given postscript name?
    Currently I am coding this for Windows, but it should be compatible, or at least have alternative code for MacOS

    Funny. I'm having the same problem and was about to post the exact same question
    In Photoshop, there is "app.fonts", which lets you get a font's postscript name from the font's name. This doesn't exist in After Effects.
    My only hope is that there's a way to get a font's postscript name in Visual Basic. I'll let you know if I find anything useful.

  • Get File Names & Creation Time of the files of a directory in App. Server

    Dear all,
                  My requirement is to fetch all the file names of a paritucular direcory in the application server. After going through SDN i got some FM's like
        1. EPS_GET_DIRECTORY_LISTING
        2. EPS_GET_FILE_ATTRIBUTES
        3. SUBST_GET_FILE_LIST
        Here EPS_GET_DIRECTORY_LISTING looks perfect for my requirement. But while I tried to test the FM from SE37 its giving exception READ_DIRECTORY_FAILED for the required Directory. But the same FM is returning file names for the root directory.
    Please look a above 2 scenario...
    ie. if I give Export parameter as
         DIR_NAME                         = '/'
         FILE_MASK                       = '*'
         The FM works fine.
    But . if I give Export parameter as
         DIR_NAME                         = '/XYZ'                      
         FILE_MASK                       = '*'
        The FM returns exception READ_DIRECTORY_FAILED .
    But the directory  /XYZ exists and there are files in it..Am I missing something with respect to the path am specifying.
    Regards,
    Antony

    Hi, see if this peace of code helps you.
    CONSTANTS DAYS1980 TYPE I VALUE 3652.
    DATA: DLIST LIKE EPSFILI OCCURS 0 WITH HEADER LINE, DPATH LIKE EPSF-EPSDIRNAM, MDATE LIKE SY-DATUM, MTIME LIKE SY-UZEIT, POINT_IN_TIME TYPE I.
    DATA: BEGIN OF FATTR OCCURS 0, FILE_NAME LIKE EPSF-EPSFILNAM, FILE_SIZE LIKE EPSF-EPSFILSIZ, FILE_OWNER LIKE EPSF-EPSFILOWN, FILE_MODE LIKE EPSF-EPSFILMOD, FILE_TYPE LIKE EPSF-EPSFILTYP, FILE_MTIME(12), END OF FATTR.
    PARAMETER P_PATH(50) TYPE C DEFAULT '/TMP' LOWER CASE.
    DPATH = P_PATH.
    CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
    EXPORTING
      DIR_NAME = DPATH
    TABLES
      DIR_LIST = DLIST
    EXCEPTIONS
      INVALID_EPS_SUBDIR = 1
      SAPGPARAM_FAILED = 2
      BUILD_DIRECTORY_FAILED = 3
      NO_AUTHORIZATION = 4
      READ_DIRECTORY_FAILED = 5
      TOO_MANY_READ_ERRORS = 6
      EMPTY_DIRECTORY_LIST = 7
      OTHERS = 8.
      IF SY-SUBRC EQ 0.
      LOOP AT DLIST.
    CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
    EXPORTING
      FILE_NAME = DLIST-NAME
      DIR_NAME = DPATH IMPORTING
      FILE_SIZE = FATTR-FILE_SIZE
      FILE_OWNER = FATTR-FILE_OWNER
      FILE_MODE = FATTR-FILE_MODE
      FILE_TYPE = FATTR-FILE_TYPE
      FILE_MTIME = FATTR-FILE_MTIME.
      FATTR-FILE_NAME = DLIST-NAME.
      APPEND FATTR.
        ENDLOOP.
      ENDIF.
      SORT FATTR BY FILE_NAME.
      LOOP AT FATTR.
      POINT_IN_TIME = FATTR-FILE_MTIME.
      CALL FUNCTION 'POINT_IN_TIME_CONVERT'
      EXPORTING
      POINT_IN_TIME = POINT_IN_TIME
      IMPORTING
      DATE = MDATE
      TIME = MTIME
      EXCEPTIONS OTHERS = 1.
      SUBTRACT DAYS1980 FROM MDATE.
      WRITE: / FATTR-FILE_NAME, FATTR-FILE_SIZE, MDATE, MTIME.
      ENDLOOP.

  • Getting File Name in Automator workflow - combine PDF

    I am using Automator to combine 2 PDF files.
    I would like to inherit one of the file names in the new PDF and append a standard text to the front of the file name.
    I am not sure how to do this. I can combine the PDFs the way I would like, but I am not sure how to plick the file name.
    my workflow is as follows.
    Folder Action targets folder where 1st PDF is added(I want this FILE NAME).
    Ger Specified finder item selects 2nd PDF to be combined.
    Sort Finder Items makes sure the new PDF pages are ordered properly.
    Combine PDF Pages combines the pages.
    Move Finder Items saves the files where i want it.
    Name single item is whre i thought to add my standard text plus the variable of FILE NAME.
    Open File in mail to set up my email.
    Anyone can help with this?
    thanks,
    Aaron

    Here is an automator workflow that does something similar so I believe you can adapt to your needs.  This workflow is setup as a service workflow. It will combine PDFs in the order in which they are selected/clicked via the Shift key.  The default name of the combined output file will be the name of the first file clicked.  Automator can be activated by CTRL clicking any of the selected PDFs.
    1. Service receives PDF files in Finder
    2. Automator Action: Run AppleScript
    on run {input, parameters}
              display dialog "Files will be combined in the order selected via the Shift key" as text
              return input
    end run
    3.. Automator Action: Trim input items
    keep the first one
    you will need to download and install this autotmator action from here:
    http://www.menace-enterprises.com/Files/Automator/Actions/Trim%20Input%20Items.d mg
    4.  Automator Action: Run AppleScript
    (* Note & Definitions
    This Applescript extracts the basename of the first selected file without its .pdf extension
    "path_basename_ext" is full path and name, e.g. User/desktop/file.pdf
    "NmExt" is filename with extension, e.g. file.pdf
    "baseName" is the base filename without extension, e.g. file
    "Ext" is the file's extension, e.g. pdf
    on run {input, parameters}
              set path_basename_ext to input
              tell (info for path_basename_ext) to set {NmExt, Ext} to {name, name extension}
              set baseName to text 1 thru ((get offset of "." & Ext in NmExt) - 1) of NmExt
      baseName
              return baseName
    end run
    5.  Automator Action: Set Value of Variable
    define baseName as the variable
    6.  Automator Action: Get selected finder items
    Options: check ignore input
    7. Automator Action: Combine PDF pages
    choose Combine by appending
    8. Automator Action: Move Finder Items
    choose To: Desktop
    Options: check show this action when workflow runs
    9. Name Single Items
    choose Basename only to: baseName
    Options: check show this action when workflow runs
    10. Open Finder Items

  • Should the web page address be included in the file name in the meta data dialog box?

    In the page properties > meta data > below is a field with the label file name: (the the area to type in the field), after the field, it is labeled .html.
    I have 2 questions here.
    1. If I type in http//:www (my page url), do I include .html at the end? I didn't know if this is automatically added because it is off to the side of the field?
    2. If I type in the entire URL address: http//:www (etc, etc).html,    after closing the page properties dialog box, I make it a habit to double check my work. What happens is the http//:www.xxx changes to (htttpwww.xxx). It drops the //: on the URL.
    So would it be better to just type in www.xxx (without the http//:www.xxx)
    and do you type in the .html at the end?
    I am assuming this will help with SEO page ranking or at least makes it easier for the search engines to crawl your site??
    I hope this makes sense.
    Advise would be very helpful.
    Ben

    You are absolutely correct with the URL Ben. Taking your above example, you just need to type in "Services" in the file name and the webpage will be exported as services.html and the URl will be  www.xyz.com/services.html.
    All the webpages (be it parent page or child page) gets physically saved at the root directory of your website on the server (where your website resides).
    This name is just the name of the file using which it is physically stored and called from the server. It does not help search Engines to crawl deeper inside the website.
    As I explained, "name which you wants the .html file to be stored with" here means the name of the physical file which is getting saved on the server.
    Most users leave the file name same as Page name. If you have it different from page name then this will be the workflow :
    Page Name : About
    File Name : test
    domain : www.mysite.com
    Now if you are  using a Menu Widget, it will list "About" in the Menu. And when end user will click on "About" then it will call the file named "test.html" from the server location (where all the files of your website are stored).
    And it will open a page with address "www.mysite.com/test.html"
    Hope I am able to explain the concept of File Name here. Please let us know if you have further queries on this.
    Regards,
    Sachin

Maybe you are looking for

  • HT4623 how to download itunes 11.1 to iphone 5

    how to download latest itunes 11.1 to iphone 5

  • Fonts in Pages

    I am trying to make the transition from Word to Pages, but one thing that is bothering me is the way fonts look. In Word, fonts look more crisp and sharp. Even more bold. In Pages, the same fonts look washed out and blurry. I thought maybe this was a

  • Problems with Old and New Appraisals (switch HAP00 / REPLA)

    Hello Experts, I'm working on a HCM Global implementation and my country is joining now, and there are others countries that have already been there since 2002. Through of switch HAP00/REPLA (transaction OOHAP_SETTINGS_PA), it is possible enable the

  • Cover flow- 6th generation ipod

    ok so apple releases an 'ipod classic' with cover flow. really cool. but will the coverflow technology be available in an update for the last version of ipods before the 'classic' (i'm pretty sure i've got the 6th gen). it would really really suck if

  • InDesign CS5.5 upgrade not accepting CS3 Design Standard Serial Number

    Hi, I currently have Adobe CS3 Design Standard on my mac computer, and when I try to upgrade my InDesign to InDesign CS5.5, It is telling me my CS3 Serial Number is not valid.  Please help. Thank you, SRGgraphics