Copying/renaming a file w/a date/time stamp

Java virgin here.....
I am sure there is a post out here on this subject somewhere...
I am trying to rename a file using the date and time EG: MYFILE05031223.txt
Where 0503 is the date and 1223 is the time.
Thanks....

Thanks so much for your help...but seeing how I am a fullfledged newbie
perhaps you can assist as to why this code will not compile...
import java.io.*;
import java.util.*;
public class rename{ 
     public static boolean renameFile(File f) {                                                  
DateFormat df = new SimpleDateFormat("MMddHHmm");
     String timestamp = df.format(Calendar.getInstance().getTime());     
     return f.renameTo(new File("Barcoden" + timestamp + ".txt")); }
I am getting the following error msg's....
C:\jdk1.3.1_08\bin>javac c:\JavaCode\rename.java
c:\JavaCode\rename.java:17: cannot resolve symbol
symbol : class DateFormat
location: class rename
DateFormat df = new SimpleDateFormat("MMddHHmm");
^
c:\JavaCode\rename.java:17: cannot resolve symbol
symbol : class SimpleDateFormat
location: class rename
DateFormat df = new SimpleDateFormat("MMddHHmm");
^
2 errors

Similar Messages

  • Save the file and give date & time stamp

    1. Reading the Excel file from the selection screen as a parameter.
    2. Using F.M. ALSM_EXCEL_TO_INTERNAL_TABLE reading Excel file into
        Internal table.
    3. Implementing the Business Logic.
    4. Move output to Final Internal table.
    5. Final internal table should generate a Flat file. By using GUI_DOWNLOAD.
    6. That flat file should be saved with the name and location given in the Excel.
    7. When ever I run the program output file will generate in the same location but with date and time stamp. Because I’m running the program for range of employees say initially I run for 1 – 10,000 employees next 10,001- 20,000 like that.
    Whenever I run for 2nd time it will overwrite the previous output, that’s the reason I’m using date and time stamp.
    Eg:
    PERSONAL Numbers              Name                                         Location
    00000001                 xxxxx-24.04.2007-10.30          C:\        
    00000002                 xxxxx-24.04.2007-10.35
    00000003                 xxxxx-25.04.2007-10.40
    00000004                                  xxxxx-25.04.2007-10.30
    Can any one help me how to save the file and give date & time stamp through hardcode?
    please help me in this issue.

    I am not clear with your problem. Based on the understanding of your question,
    there  can be two cases.
    1- U want to insert time stamp in the output file.
    2- Time stamp is already there, u just have to solve the overwriting issue.
    If your question goes with option 2, You can make use of import parameters
    <b>CONFIRM_OVERWRITE</b> : Which will ask for confirmation before overwriting.
    <b>APPEND</b> : which you can choose either to append the data to the existing file or overwrite it.
    Please inform if the issue is not resolved.
    Message was edited by:
            BINU RAJ BINU

  • PTP camera - how to retain date/time stamp on photos [Gnome]

    I have a USB PTP Camera that comes up in Nautilus under "gphoto2://[usb:001,007]/DCIM"  I can copy/paste the photos off the thing to ~ but the date/time stamp gets changed to the present.  How can I copy them over retaining the original date/time stamp?

    By using the exif info I suppose.
    http://linux.die.net/man/1/exiv2
    -t
        Set the file timestamp according to the Exif create timestamp in addition to renaming the file (overrides -k). This option is only used with the 'rename' action.
    Last edited by karol (2010-07-22 22:13:26)

  • Retaining date/time stamp when copying files from a backup network drive

    How do I retain the date/time stamp when copying files from a backup such as a external drive or a network drive?

    i don't trust MA at all. known to create a lot of problems.
    instead, see the green box in this user tip.

  • The export file from a calc script - naming and date/time stamp

    Here is a simple calc script to export data.
    2 questions:
    1. Is there an easy way to add a date/time stamp on the name of the data file so that it does not overwrite the older ones every time?
    2. I tried to specify the path so that it write to another server. "\\mfldappp011\E:\Exp_AW.txt". It's not working. How should I specify the path ?
    Fix (@Relative("Yeartotal",0),"Actual","Working",&ActualYear);
    Dataexport "file" "," "C:\Exp_AW.txt" "#MI";
    EndFix;
    Edited by: user9959627 on Sep 7, 2012 11:25 AM

    Probably easiest to call the maxl script from a command line script, then rename the exported file to include the tme stamp and copy/move it to a location.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Use files based on a date/time stamp in order

    I have a PL/SQL procedure that is using BFILE to pick-up and read a file. The file will have the same starting characters for every file followed by a date/time stamp: AAAA_09232009
    I need my procedure to use the file with the oldest date first and then rename the file after the procedure has run through it. Can anyone assist me in this? Below is the beginning of the procedure --Thanx in Advance:
    create or replace PROCEDURE XML_READ_FILE
    as
    v_bfile BFILE := BFILENAME('XML_DIR', 'AAAA_09232009.xml');
    v_clob CLOB;
    BEGIN
    DBMS_LOB.createtemporary(v_clob, TRUE);
    DBMS_LOB.OPEN(v_bfile, DBMS_LOB.lob_readonly);
    DBMS_LOB.loadfromfile(v_clob, v_bfile, DBMS_LOB.lobmaxsize);

    See if this helps:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:439619916584

  • Can I copy my iTunes files and folders to Time Capsule wirelessly from my PC?

    Can I copy my iTunes files and folders to Time Capsule wirelessly from my PC? I was wondering since my iTunes files and folders are connected to iTunes.

    You can but the TC is the worst possible location. The design is slow to start and quick to stop data connections.. that will cause trouble.
    Moving folders has specific instructions.
    http://support.apple.com/kb/ht1364
    Move it to an external hard disk fine.. but be very sure you will not be happy with the TC as a location.

  • How do you vary the Date/Time stamp format in File Adapters

    In the receiver channel of the File Adapter where you specify the 'File Name Scheme', you do have the option of specifying a 'File Construction Mode' of 'Add Time Stamp'.  How can you specify a different Date/Time stamp format ( eg MM/DD/YY vs YYYYMMDD vs MMDDYY, etc. ) without changing the Date/Time stamp for the entire SAP system?  Also, can you control where the Date/Time stamp appears in the filename?

    Hi,
    There are many threads discussing the same issue. Go thro the following:
    Dynamic file name (Date) in Receiver File Adapter
    Receiver File Adapter - TimeStamp
    Bhavesh's reply in above thread:
    You can use Adapter Specific Identifiers and then change the file name in the mapping. Append the tiem stamp in the format that you want and so on.
    Just use this code in an UDF,
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String SourceFileName = conf.get(key);
    java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat( "yyyyMMdd" );
    dateformat.format( new java.util.Date() );
    String newfilename=SourceFileName+dateformat;
    // change to new file name
    conf.put(key, newfilename);
    return "";
    Regards,
    P.Venkat

  • Need to add date/time stamp to file name without time change creating new files

    We have setup our application to save data once a trigger event occurs. We also need the date/time stamp as part of the file name. We used Format Date/Time String and concatenated it into the file name. It all works good, but as the time changes (seconds, minutes, etc.) it causes the Write to File to create a new file with the new filename. Is there a way to create the file and save/latch/buffer the time in the file name so that it doesn't create a new file for every second?
    I've attached a shot of the relevant part of our VI. It's all in a big while loop. The data save is in a case/switch so that when it is triggered it starts saving. (The for loop is to split the data up
    into 4 different files). Like I said, it all works except new files are created every second as the time changes instead of just putting it all in one file with the initial time in the file name.
    Attachments:
    TimeInFileNameQuestion.jpg ‏46 KB

    I need a loop in order to use a shift register. I cannot stop the outer while loop (because it would stop the hardware from collecting data), and I cannot add loops inside which bogs down the processor to where the app stops. I've attached a simpler version of my VI which illustrates the problem. While the button is pressed (the trigger) it should save the data (in this case just cycle numbers) into one file with the initial date/time. But, you can see that it creates 1 file/second. I tried using shift registers, but without adding extra loops I can't see how to do it. Thanks
    Attachments:
    FileNameTest.vi ‏29 KB

  • Update file date/time stamp using java

    Let me explain you what I am going through:-
    I have created a java based installer using Jexpress tool and after I do the installation of my files, the files takes the current date rather then taking the date when it was created or modified.
    Everything goes into JAR and I heard that Jar file do not retain the date/time stamp of the file.
    I would like to know if we can change the date and time stamp of the files using Java.
    Is there any method to do that or can we do this by writing the java class?
    Thank You
    Mehul

    Did you check it?
    I did.
    $ jar cvf ~/ui *.m3u
    added manifest
    adding: Amollhgv.m3u(in = 42) (out= 24)(deflated 42%)
    adding: Brand1.m3u(in = 56) (out= 27)(deflated 51%)
    adding: Brand2.m3u(in = 42) (out= 24)(deflated 42%)
    adding: Brand3.m3u(in = 42) (out= 24)(deflated 42%)
    adding: Brand4.m3u(in = 42) (out= 24)(deflated 42%)
    adding: Brand5.m3u(in = 42) (out= 24)(deflated 42%)
    adding: Brand6.m3u(in = 42) (out= 24)(deflated 42%)
    adding: Edurhgv.m3u(in = 42) (out= 24)(deflated 42%)
    $ unzip -l ~/ui
    Archive:  /home/ijbalazs/ui
      Length     Date   Time    Name
            0  12-04-03 17:53   META-INF/
           71  12-04-03 17:53   META-INF/MANIFEST.MF
           42  08-26-02 01:03   Amollhgv.m3u
           56  11-22-98 01:15   Brand1.m3u
           42  08-26-02 01:04   Brand2.m3u
           42  08-26-02 01:04   Brand3.m3u
           42  08-26-02 01:04   Brand4.m3u
           42  08-26-02 01:04   Brand5.m3u
           42  08-26-02 01:04   Brand6.m3u
           42  08-26-02 01:04   Edurhgv.m3u
          421                   10 files

  • Need to change Date/Time stamp on jpeg file

    I combine images into panoramas using PTGUI. The problem is that the output image file is date stamped as the time that I created the image. I really want the date/time stamp to be the same as the images that go into the panorama. I cannot find a way in LR to change this.
    Lee

    > By the way, Victoria, should you be promoting your url here? It belongs in your profile. It's in the forum rules somewhere and others have been picked up on it before.
    >
    > Joe
    Oh, thanks Joe, I'll change that then. I did go looking for forum
    rules, but couldn't find any!
    Victoria

  • Batch file - how to Date & Time Format as January 6, 2014 - 8:54 PM Eastern

    Batch file - how to Date & Time Format as January 6, 2014 - 8:54 PM Eastern

    Hi Dhiravia,
    If you want to convert the month format, please refer to the batch script below:
    SET Month=%DATE:~4,2%
     if %Month%==01 set Month=JAN
     if %Month%==02 set Month=FEB
     if %Month%==03 set Month=MAR
     if %Month%==04 set Month=APR
     if %Month%==05 set Month=MAY
     if %Month%==06 set Month=JUN
     if %Month%==07 set Month=JUL
     if %Month%==08 set Month=AUG
     if %Month%==09 set Month=SEP
     if %Month%==10 set Month=OCT
     if %Month%==11 set Month=NOV
     if %Month%==12 set Month=DEC
     echo %Month%
    To convert the date format via cmd, please also check this article:
    http://myblog4fun.com/archive/2012/01/06/getting-the-current-date-and-time-from-bat-files.aspx
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang
    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 Support, contact [email protected]

  • FileMonitor issue for date time stamp change.

    Hi I have an app that runs with a minor issue and I am looking for some insight for a workaround or code change.
    I have a File Monitor that checks a specific directory every second.
    Users send a batch run to this directory throughout the day. There are two types of files, .ZIPs and .DONEs.
    So for each .ZIP a .DONE is sent to notify the app it can begin to process the file.
    Here is what I receive
    /elements/process/File1.ZIP     Oct 15 08:19
    /elements/process/File1.DONE     Oct 15 08:19
    The problem I am encountering is sometimes the .DONE and. ZIP are sent and the date time stamp of both files are the same so when the monitor reads the directory it looks like there is no change so both files sit in the directory and do not process. To make this work, I usually go in and touch a file to change the date time stamp.
    This is a java app that runs on an AIX box.
    Here is my code, is there anything any once can suggest to help me out. Thanks in advance.
       * Subclass of FileMonitor, Handles the timer event
       * @param none
      private class FileMonitorNotifier extends TimerTask
        public void run()
          // Loop over the registered files and see which have changed.
          // Uses the Modifed DateTimeStamp to determine if there was a change.
          // Use a copy of the list in case listener wants to alter the
          // list within its fileChanged method.
            try
                Collection files = new ArrayList (hmFiles.keySet());
                for (Iterator i = files.iterator(); i.hasNext(); )
                    File file = (File) i.next();
                    long lastModifiedTime = ((Long) hmFiles.get (file)).longValue();
                    long newModifiedTime  = file.exists() ? file.lastModified() : -1;
                    //      Check if file has changed
                    if (newModifiedTime != lastModifiedTime)
                        //      Register new modified time
                        hmFiles.put(file, new Long (newModifiedTime));
                        // Notify listeners
                        for (Iterator j = colListeners.iterator(); j.hasNext(); )
                            WeakReference reference = (WeakReference) j.next();
                            FileListener listener = (FileListener) reference.get();
                            // Remove from list if the back-end object has been GC'd
                            if (listener == null)
                                j.remove();
                            else
                                listener.fileChanged (file);
            catch(Exception ex)
                 m_odLaunch.logError(OdIntegrationConstants.ERROR_LEVEL_MIDLEVEL, ex);
         }

    Yes, I guess you are right, I don't care what time each file came, as long as I have both I can being to unzip and process and delete the .DONE.
    The code itself was based on if a filechanged then do work.... I could just take this out. Thanks!
    * This is the main entry point when there is a change to the modified date/time
    *  of the monitor directory
    * @param file directory we are monitoring
         public void fileChanged (File file)
              StringBuffer sbMessage;
              try
                   sbMessage = new StringBuffer();
                   //Make sure this is a Directory
                   if(file.isDirectory())
                        //Return list of files with extension we are looking for
                        File[] arFiles = file.listFiles((FilenameFilter)new FileSuffixMonitor(m_odLauncher));
                        for(int i=0;i < arFiles.length;i++)
                             sbMessage.append("Found file association to move-" );
                             sbMessage.append(arFiles.toString());
                             m_odLauncher.logInstance(sbMessage.toString());
                             processMoveFile(arFiles[i]);
              catch(Exception ex)
              sbMessage = null;

  • Video and photo date&time stamp (nokia 5800)

    Hi,
    i have the nokia 5800 and i'm having a strange problem.
    i had to format my memory card so i copied everything to my pc, and after i formated it i copied everything back to the memory card.
    now if i open an image and check to see the date it's showing me the date and time i copied the file back to the memory card instead of the date&time i took the image.
    same thing with the videos.
    i have the same photos in my pc and when i check the exif data i can see the date when i took the photo.
    i opened the videos with "media player classic" and i looked for the "media info", and i can see there when the video was made but it's in UTC time.
    how can i make the phone read the correct time when the images and videos were taken?
    Thanks for any help,
    Erez.

    Sach1n wrote:I want to put Date & Time Stamp on photos clicked via Nokia 5800XM. Is it possible?
    Hi Sach1n
    Unfortunately that is not feasible but you can view the EXIF Data on the 5800XM with a python application as per screenshot here:http://i35.tinypic.com/ht9ovs.jpg
    Happy to have helped forum in a small way with a Support Ratio = 37.0

  • Embedded Date & Time Stamp

    First off, I am not a programmer and have not worked with javascript.
    My question is can there be a code embedded into a file that when it prints, verbage is printed on the document, such as "COPY, valid for 30 days from Date/Time"?  The reason I say file is that I don't want to have to put the code on every copy of Adobe (Acrobat or Reader) and only want it on certain documents not all of them.
    If so, could you tell me where this would go and where I could find scripting to use or learn?

    "Dynamic Print Date" javascript code in Batch Process has code for creating the field and adding the needed script through Acrobat's Batch Processing or Actions processing. You need to add a form field and then create a 'Will Print' action to add the date and time.
    Learning Center at Acrobat Users Community has a number of resources for learning about forms and scripting.

Maybe you are looking for

  • Problem with New Macbook 2.2ghz and 2x2gb Sodimm Ram 800mhz

    Hi..I bought the newest Macbook white 2.2ghz Santa Rosa and I wanted to upgrade default ram up to 4 gb 800mhz. I bought 2 Sodimm Adata..I tried to put them toghether inside my macbook and it doesn't boot.I click power button but it only turns on slee

  • How to give grants on runtime objects

    Hi, I have created read only apps user,but i want to have a trigger/procedure which should give grant at runtime when the object i.e synnonym/view created in apps user. I have tried the anil passi read only apps user-trigger but it is throwing errors

  • PO Strtergy Release Workflow

    Dear All, I have a workflow whose sceanario is like this. In a plant there are say 2 levels L1 and L2. Now when the PO Strtegy is release a mail should shoot from L1 to L2. But currently,the moment a PO is created a mail is shooted from L1 to L2. I a

  • Safari pop-up button invisible

    I have an original iPad. I am viewing a pop-up that looks different on my iPad than my friend's iPad. The popup had a list of text with two buttons at the bottom of the pop up. On mine, the buttons will show. On my friend's, the buttons are simply no

  • Photos have white dots in burned project

    I made a photo slideshow in imovie and the photos have white dots showing up on the dvd (but not on the computer). Any thoughts?