Date attachment to a fileName which is given as commandLineargument

I want to append the current date in dd-mm-yy format to a file name which is given in command prompt
suppose if had given stat.txt in the command prompt
i want to write what ever the contents in the stat.txt i want to store in the form of
stat_11032005.txt
where 11 is the date,3 is the month no, 2005 is year.
my code is
class date
     public static FileWriter stats;
public static void main(String args[]) {
     try
stats = new FileWriter(args[0]+(new Date()).toString());
     stats.write("sdfjal");
     stats.write("kjakdfj");
     catch(IOException ioe)
          System.out.println(ioe);
My command line argumnet is kk then i have to get file name as kk__11032005.txt
when i run this program i am getting file not found exception
plz suggest how to proced how to proced further to reach my solution
Thanks(in advance)
ramu

import java.io.*;
import java.text.*;
import java.util.*;
final public class Foo {
    static final public void main(final String[] args) {
        try {
            SimpleDateFormat formatter = new SimpleDateFormat("MMddyyyy");
            FileOutputStream fileOut = new FileOutputStream("stats.txt_" + formatter.format(new Date()));
            FileInputStream fileIn = new FileInputStream("stats.txt");
            byte[] buffer = new byte[2048];
            int bytesRead = fileIn.read(buffer);
            while (bytesRead >= 0) {
                if (bytesRead > 0)
                    fileOut.write(buffer, 0, bytesRead);
                bytesRead = fileIn.read(buffer);
            fileOut.flush();
            fileOut.close();
            fileIn.close();
            System.exit(0);
        catch (Throwable e) {
            e.printStackTrace();
            System.exit(1);
}- Saish

Similar Messages

  • Is there a screensnap app which uses date/time as the filename?

    I'm looking for a simple screensnap app which uses the current date/time as the filename... e.g. 010220120500 or something similar.

    Ah... automator... the ******* step-child of the OS.  Forgot about that one. I checked out your link and ran up against a barrier. I can make a sequential workflow, a date/time workflow in day/month/year and a couple other variations... but not a truly sequential day/date/year/hour/minute/second non-repeating workflow. Oddly enough I can make a hour/min/sec workflow but that would not absolutely define the file and could create duplicate filenames.
    I've looked over a lot of these screensnap apps and haven't found one that can do a non-repeating (thru system on/off sequences) filenaming thing. Maybe it can't be done.
    Automator was a good idea and it was fun using it again. Thanks Jeff.

  • How to load data from a  flat file which is there in the application server

    HI All,
              how to load data from a  flat file which is there in the application server..

    Hi,
    Firstly you will need to place the file(s) in the AL11 path. Then in your infopackage in "Extraction" tab you need to select "Application Server" option. Then you need to specify the path as well as the exact file you want to load by using the browsing button.
    If your file name keeps changing on a daily basis i.e. name_ddmmyyyy.csv, then in the Extraction tab you have the option to write an ABAP routine that generates the file name. Here you will need to append sy-datum to "name" and then append ".csv" to generate complete filename.
    Please let me know if this is helpful or if you need any more inputs.
    Thanks & Regards,
    Nishant Tatkar.

  • Unable to load sql script which is given in this tutorial: load_sample.sql

    Hi!
    To start, I inform you that I am beginner with Oracle. I installed Oracle 10g Express Edition on my computer(O/S: window xp)
    Then I go on http://127.0.0.1:8080/apex/f?p=4550:9:4181329966856697::NO:::, I login with system account, I create another dba account etc ... all looks very well ! Then I follow this tutorial: http://st-curriculum.oracle.com/tutorial/DBXETutorial/index.htm
    and I am unable to load sql script which is given in this tutorial: load_sample.sql (page:What to do first> Loading Data). I try with a little sql script and same result. I use gedit with UTF-8 and load in UTF-8, my browser is Firefox .
    The result is: when I upload a script, The browser returns "script uploaded." Then I can click on my script but the file is empty ! Nothing is done when i click on "run". Also I can' create a script. To import a script I have to copy one by one request in sql commands. I try also to change the owner of load_sample.sql:
    But it doesn't work. If someone has an idea ? Thanks for your help.
    regards
    meraj

    Problem Solved.
    When I switched default browser from mozilla firefox to ie(internet explorer) the problem is solved i got this from forum post (Script Editor Not Working
    But still i want to know why "load_sample.sql" is not run with the default browser(mozilla firefox).

  • ESS Error- Data source contains no columns which can be displayed

    Hi
      After the application of support packs, an error is observed in ESS applications where the data/content has to be displayed in tabular format.
      On accessing Personal Data application, error message is displayed -
       Error Occured
       Data source contains no columns which can be displayed
       Screenshot is also attached for reference.
       Please help in resolving the issue.
    Regards
    Shaily

    Hi all!
    I have the same problem, any ideas how to analyze and solve the problem?
    Regards
    Peter Meyer

  • I am working in Adobe Acrobat 9 Pro and just created a pdf form from a MS Word document. I need to find out how to have a date field in my form which will update automatically. Can some one out there help me?

    I am working in Adobe Acrobat 9 Pro and just created a pdf form from a MS Word document. I need to find out how to have a date field in my form which will update automatically.

    Update automatically under which circumstances, exactly?

  • How to retrieve data from an Excel file which is located on server

    hi everybody,
                    I am using SAP NWDS 2004s .     
                I have done an application on how to export the table data into an Excel .
    Now i want to get the data from an Excel file which is located in server and display that data which is in excel in a View for example a Sample view in Webdynpro  .
    In Sample view i took a uielement textview to display the data ....   
    can any one help how to procced further
    Thanks in advance
    Madhavi

    Options to read Excel data to WebDynpro context
    Reading Excel Sheet from Java without using any Framework
    Reading Multiple Sheets of Excel Sheet from Java
    Few Threads
    How to Display the content of Excel file into Webdynpro Table
    Is it possible to upload data from excel file(.xls)
    Re: How to export the data as integer into excel sheet?
    regards
       Vinod

  • I recently upgraded to iWork v9.0.3, but when I access each applications the versions are different (i.e. Pages V.4.1, Numbers V2.6, Keynote V5.1.1) with a install date of 3/18/09 -- which is not the current install date of 2 weeks ago. Why?

    I recently upgraded to iWork v9.0.3, but when I access each applications the versions are different (i.e. Pages V.4.1, Numbers V2.6, Keynote V5.1.1) with a install date of 3/18/09 -- which is not the current install date of 2 weeks ago. Shouldn't Pages, Numbers, and Keynote show version 9.?? My MAC confirned installation of v9.0.3 and even accepted the software code. With this discrepancy, how can I determine if the latest was installed and operational? I even downloading v9.0.4, 9.0.5, and 9.1. When I tried installing these downloads it popped up note stating that a later version of Keynote was already installed.

    You used the data.  Verizon can not see what it was sued for.  However your phone can see whats apps used the data.  go to settings-data usage- there will be a place that says data usage cycle.  line the dates up with your cycle.  then there will be a bar graph below that   extend bother white bars one all the way to the left and one all the way to the right.  after those are extended below that will be a list of apps,  there should be one that used over 2 gb and that will show you what app used that data in her purse

  • How to export data from a spread sheet which has multiple work sheets?

    How to export data from a spread sheet which has multiple work sheets to a single text file with fixed length fields?

    Hello s1,
    saving them as CSV will not give a fixed legth output but, as the naming says, a Character Separated Value file.
    Regards
    Marcus

  • How to insert automatic Date/Time Stamp on filename?!

    I have a simple chart that I fill out for work hours and whatnot every day with the Numbers program.
    I would love to have the date inserted into the filename automatically so that I don't have to manually enter it every day when I save.
    Is this possible?

    --
    --[SCRIPT savewith_date_timestamp]
    Enregistrer le script en tant que Script : savewith_date_timestamp.scpt
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
    Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
    Aller au menu Scripts , choisir Numbers puis choisir savewith_date_timestamp
    Le script enregistre les documents Numbers ouverts ayant été modifiés.
    Il crée également une copie dont le nom inclut la date et l'heure.
    --=====
    L'aide du Finder explique:
    L'Utilitaire AppleScript permet d'activer le Menu des scripts :
    Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case "Afficher le menu des scripts dans la barre de menus".
    Sous 10.6.x,
    aller dans le panneau "Général" du dialogue Préférences de l'Éditeur Applescript
    puis cocher la case "Afficher le menu des scripts dans la barre des menus".
    --=====
    Save the script as a Script: savewith_date_timestamp.scpt
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    Go to the Scripts Menu, choose Numbers, then choose "savewith_date_timestamp"
    The script save open and modified Numbers documents.
    It create duplicates with date_time stamp appended to the file names.
    --=====
    The Finder's Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the "Show Script Menu in menu bar" checkbox.
    Under 10.6.x,
    go to the General panel of AppleScript Editor’s Preferences dialog box
    and check the “Show Script menu in menu bar” option.
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2010/11/11
    --=====
    on run
    -- my savemodifieddocuments("Pages")
    -- my savemodifieddocuments("Keynote")
    my savemodifieddocuments("Numbers")
    end run
    --=====
    on savemodifieddocuments(theApp)
    local titres, aDoc
    tell application "System Events" to set titres to title of processes
    if theApp is in titres then
    tell application theApp
    repeat with aDoc in every document
    if modified of aDoc then
    save aDoc
    tell application "System Events" to my duplicatewith_date_timestamp(path of disk item (path of aDoc))
    end if
    end repeat
    end tell
    end if
    end savemodifieddocuments
    --=====
    on duplicatewith_date_timestamp(fichier) (* fichier is an HFS path*)
    local Nom, ext, dossier, nomZip, source, dest
    tell application "System Events" to tell disk item ("" & fichier)
    set Nom to name
    set ext to name extension
    set dossier to path of container
    end tell
    set source to quoted form of POSIX path of (fichier)
    set Nom to text 1 thru -(2 + (count of ext)) of Nom
    set nomZip to Nom & (do shell script "date +_%Y%m%d-%H%M%S") & "." & ext
    set dest to quoted form of POSIX path of (dossier & nomZip)
    do shell script "ditto " & source & " " & dest
    end duplicatewith_date_timestamp
    --=====
    --[/SCRIPT]
    Yvan KOENIG (VALLAURIS, France) jeudi 11 novembre 2010 10:37:19

  • Cell data not getting refreshed in which user enters data OO ALV(editable)

    Hi Friends,
    I am using OO ALV for editable grid display.
    I am unable to change grid data in the cell in which user enters something, using OO ALV. Did through debugging of my own program and found that some problem with system program. Then I did all system debugging. Could not find out why is the grid not getting refreshed with the new data in the cell in which user had entered some value. Rest of the cell's data are getting refreshed with the values which i am updating in the final internal table. I can see that the data in the final internal table is changed for the cell in which user enters data. But even after the call of
          CALL METHOD obj_alvgrid1->refresh_table_display
    does not refreshes the data in the cell in which user had entered data. Rest of the cells data are getting refreshed.
    Piece of code:
      SET HANDLER obj_event_receiver->handle_data_changed
                                         FOR obj_alvgrid1.
        METHODS: handle_data_changed
                       FOR EVENT data_changed OF cl_gui_alv_grid
                           IMPORTING er_data_changed
                                     e_onf4
                                     e_onf4_before
                                     e_onf4_after.
    METHOD handle_data_changed.
      DATA : v_valid    TYPE char1,
             v_refresh  TYPE char1.
    *--check mt_good_cells semantically
      CALL METHOD perform_semantic_checks( er_data_changed ).
    *--If PBO is again visited, just refresh the ALV grid.
      CALL METHOD obj_alvgrid1->refresh_table_display
        EXCEPTIONS
          finished = 1
          OTHERS   = 2.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
    ENDMETHOD.
    METHOD perform_semantic_checks.
        LOOP AT er_data_changed->mt_good_cells INTO w_good.
          v_index = sy-tabix.
          CASE w_good-fieldname.
            WHEN 'ZASCAS'.
    *Now here based on some conditions I am changing my final internal table i_zamtsmatnp
                              MODIFY i_zamtsmatnp FROM w_zamtsmatnp INDEX
                                               w_good-row_id TRANSPORTING
                                                 zascas modif.
    User enters data in zascas field. Based on the data entered, I am changing other fields which is getting refreshed. I am also changing zascas in the program even after user had already entered the value which was bit wrong and i am correcting it in the program on the even "data_changed" even.
    Please help me friends as i m strugling past hours wondering why the data is not getting refreshed for the cell in which user enter data.
    Regards,
    Surya

    Hi Surya,
       The approach you are following is correct. You need to use the comibnation of all these things:
    Event - DATA_CHANGED
    Methods - CHECK_CHANGED_DATA
                 -  GET_CHANGED_DATA.
    However, here are few standard programs which are having similar functionality.
    BCALV_EDIT_03
    BCALV_EDIT_07
    Check out these once.
    Note: If anything is helpful, dont forget to reward points
    Thanks,
    Adithya K
    SAP Practise
    [email protected]

  • Hi I shoot on a canon 5d mk11 and I record my audio on an external device yet when I open up my footage in final cut pro x I can't find my external audio files only the ones attached to the clip which are off the camera mic

    I shoot on a canon 5d mk11 and I record my audio on an external device yet when I open up my footage in final cut pro x I can't find my external audio files only the ones attached to the clip which are off the camera mic

    What device?
    What format?
    How are you importing it?
    Can you find the external audio with Finder?
    Where is your destination file when you import it?
    Andy

  • I was having an issue opening a spreadsheet with the file extension .xlsm. This appears as an attachment from a client which means macros were utilized when creating the spreadsheet. The problem lies in. The iPads ability to open the attachment. I downloa

    I was having an issue opening a spreadsheet with the file extension .xlsm. This appears as an attachment from a client which means macros were utilized when creating the spreadsheet. The problem lies in. The iPads ability to open the attachment. I downloaded the numbers app thinking this would be a default software to open any and all spreadsheets.
    Please Help!
    Ipad 2- iOS5

    You may need a version without macros on it. Unfortunately, pretty much all apps are skinned down versions of their original program, often with less functionality. For example in a word document I can italicize,bold and underline, but I only have a handful of fonts to play with and I don't think I can insert tables or images.
    It is very possible that the app simply cannot run macros, which means that document may never work on an iPad.

  • Search for a file with part of a filename in a given folder.

    How can I search for a file with part of a filename in a given folder?
    Or can I change the columns in Advanced Search so that the heading is filename?

    thanks, Michel. it had occurred to me to put a scratch tag on the folder, but I was hoping for an easier way. in future I'll do as you suggest though, because it's easier than what I have been doing.
    daryl

  • How to set a date string in a textbox which bind to a Date type datasource

    Hi,
    I found i can't set a default date value in a textbox which bind to a Date type datasource. Even i tried copying a date string which is picked by the calendar date picker and copy the exactly same string into my source code. It just doesn't work and gives me error said "Invalid date value".
    My source code is like this:
                    oEditText = (SAPbouiCOM.EditText)oItem.Specific;
                    oEditText.DataBind.SetBound(true, "", "dtFrom");
                    oEditText.Value = "09/08/2010"; //DateTime.Now.ToString("dd/MM/yyyy");
    Any suggestion?
    Thanks!
    Lan

    Hi,
    oItem = oForm.Items.Item("10")
    oEdit = oItem.Specific
    oEdit.String = Format(Today.Date, "dd/MM/yyyy")
    or
    datestring = oForm.Items.Item("10").Specific.value
    datepass = Left(datestring, 4) & "/" & Mid(datestring, 5, 2) & "/" & Mid(datestring, 7, 2)
    dtDocDate = Date.Parse(datepass)
    Thanks,
    Mahesh

Maybe you are looking for

  • I give up. Have had a problem with HD Bay 4, and can't solve it

    I have had my Mac Pro for a year, through Tiger and now Leopard, and it has been a great machine... except. From the night I un-boxed it, it has refused to run a drive in bay 4. it partitions fine, looks fine, and then when copying something (say a 1

  • Video import from PAL camcorder

    I have just bought a Canopus ADVC110 which converts analog video to digital and have it hooked into my Powerbook Pro via a firewire lead. I have my analog PAL camcorder tied into the canopus and am attempting to import some PAL video but not getting

  • Which one do you choose? JellyBean or trade-in credit or nothing?

    I read news from Verge : "Motorola also said that it would offer a $100 trade-in credit to those who bought a Motorola phone in 2011 (or later) that isn't eligible for the update to Jelly Bean." Resource :   http://www.theverge.com/2012/9/6/3298835/m

  • Photoshop cs5 hangs on launch when loading brushes

    Photoshop cs5 hangs on launch when loading brushes.  I have to do a hard reboot and reset the preferences.  In the past 2 days I have had to do this 3 times.  I have the latest drivers.  below is my hardware.  I am also running lightroom.  I did not

  • Texas Hold 'Em Crashes (3G)

    I bought this crazy 3G phone and tried to play the texas hold em game. It keeps crashing on me when ever i try to place a bet, rotate the screen or sometimes it just crashes for the sake of crashing. Is this a known issue with this game? Any ideas on