How to copy files and last modified date

Does anyone out there know who to copy files files from one directory to another and retain the date time stamp of the source files?
I've been able to write some code that copies files from one directory to another but I always end up with a Date Last Modified that is based on the current date. I want to retain the date time stamp from the original file that I copied. Is this possible in Java?
Mike

Call file.setLastModified() after you close it.

Similar Messages

  • Load file on db with file system last modified date info

    Hi,
    i have e procedure for load a file on my DB table.
    How to write on my table the last modified date read for file system?
    Thanks in advance
    Marc

    Try this example to use dbms_pipe for executing the OS commands to get the last modified date of a file.
    calling shell script from sql procedure

  • Importing Notes into SOD - How can I set the Last Modified Date?

    We are still in the process of getting all of our users over to Siebel. We launched in waves and therefore have some users who were still utilizing the legacy systems while some were working away in Siebel. What I'm trying to do now is to take the reps notes from the legacy system and bring them back over into Siebel. I've got the file created with the account external id, subject, note(description) and the date the note was created in the legacy system. When I try to import the date can not be set and is defaulting to the date the acutal note was created in Siebel.
    This is a problem as I have 3 years of account history that must get loaded and if I import it all now it will push the current notes in the system to the very bottom of the list which will upset the reps who started uisng Siebel in the first wave.
    My goal is simply to order them from newest on top to oldest but I can't seem to find a way to do that using the import tool as Last Modified Date isn't an option for me to import.
    Is there a way to do it? If not does anyone know of a work around to achieve the same goal?
    Any help is much appreciated.
    - john

    Would that show up in the Notes section of the account detail if I do that? I've never tried that one before.
    After the R16 releiase the reps use the "hover" functionality to see their notes data in the top right of the application (or in the notes section of the account details).
    Edited by: Xeroid05 on Nov 25, 2009 8:09 AM

  • How can you find the Last Modified Date of a particular table

    Hi,
    I want to show to the LAST MODIFIED date of a particular table to the user before refreshing the table with new data. Experts please suggest me the way using JDBC-SQL connection.

    There is no generic SQL way for this. It depends completely on the features your DBMS offers. With Oracle you'd need to create column which gets updated in a trigger. I believe MS SQL Server offers a special data type for this, which is updated automatically. I don't know about others.

  • Storing the last modified date for files in a HashMap

    This method gets a list of all the .java files in the source subdirectory, gets the last modified date for them and stores the file name and last modified date in a HashMap.
    import java.util.HashMap;
    import java.io.FilenameFilter;
    import java.io.File;
    import java.util.ArrayList;
    public class myClass
         public static void main(String[] args)
              HashMap result = getLastModified();
         static FilenameFilter javaFilter = new FilenameFilter()
            public boolean accept(File dir, String name)
                return name.endsWith(".java");
         public HashMap getLastModified()
              HashMap lastModified = new HashMap();
              ArrayList javaFiles = new ArrayList();
              File sourceDir = new File(".\\Source");
              File currentFile;
              long lLastModified;
              //get a list of all the .java files in the source directory
              javaFiles=listFiles(javaFilter);
              //for all .java files get and store the last modified date
              for(int i=0; i<javaFiles.size(); i++)
                   currentFile=(File)javaFiles.get(i);
                   lLastModified=currentFile.lastModified();
                   lastModified.put(currentFile, lLastModified);
              return lastModified;
    }The problems I am getting are:
    >
    The method listFiles(FilenameFilter) is undefined for the type myClass
    and
    >
    The method put(Object, Object) in the type HashMap is not applicable for the arguments (File, long)
    can anyone help? What's the best way to go aobut this?

    Thanks for the replies abenstex I modified it so that javaFiles is now a File[] and made the change you suggested but I still have the second problem, here's the code so far:
    import java.util.HashMap;
    import java.io.FilenameFilter;
    import java.io.File;
    import java.util.ArrayList;
    public class myClass
         public static void main(String[] args)
              HashMap result = getLastModified();
         static FilenameFilter javaFilter = new FilenameFilter()
            public boolean accept(File dir, String name)
                return name.endsWith(".java");
         public HashMap getLastModified()
              HashMap lastModified = new HashMap();
              File[] javaFiles = {};
              File sourceDir = new File(".\\Source");
              File currentFile;
              long lLastModified;
              //get a list of all the .java files in the source directory
              javaFiles=sourceDir.listFiles(javaFilter);
              //for all .java files get and store the last modified date
              for(int i=0; i<javaFiles.length; i++)
                   currentFile=(File)javaFiles;
                   lLastModified=currentFile.lastModified();
                   lastModified.put(currentFile, lLastModified);
              return lastModified;

  • Automatically (programming) Extracting last modified date

    Hi
    I have the url addresses of sesveral documents stored in SharePoint.  Those addresses are stored in a column within Excel.  There is one address per line (row).
    I would like to extract for each file its last modified date.  Ideally in an automatiic mode.
    All files are not in the same "folder".
    How could I achieve that?
    Many thanks in advance

    Hi,
    you can write a query to get all the files from the doc library and use SPFile.Properties to get the last modified date
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile.properties.aspx
    your code will be like the below (Taken from above link)
    SPSite oSiteCollection = SPContext.Current.Site;
    using(SPWeb oWebsite = oSiteCollection.AllWebs["Site_Name"])
    SPFolder oFolder = oWebsite.Folders["Shared Documents"];
    SPFileCollection collFiles = folder.Files;
    foreach (SPFile oFile in collFiles)
    System.Collections.Hashtable collHashes = file.Properties;
    System.Collections.ICollection collKeys = hash.Keys;
    foreach (object oKey in collKeys)
    Response.Write(SPEncode.HtmlEncode(oKey.ToString())
    + " :: " +
    SPEncode.HtmlEncode(hash[oKey.ToString()].ToString())
    + "<BR>");
    another option would be to use SPFile.TimeLastModified
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile.timelastmodified.aspx
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfile_properties.aspx
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • How do you change the last opened date in Lion?

    In many screens the files are organized automatically by last opened date.  This information is not available when you click command info on the individual file, however, if you list out the files and click on the option to show last opened on the row on the top you will see this information.
    From time to time it is useful to change the creation and modification dates to move where files are displayed in various windows.  While there are utilities and articles about changing the creation and last modified date using third party software or the terminal, I have not been able to find any way to change the last opened date.  This is useful if you wish to hide a file you recently opened so that another user can't just find it as one of the last opened files. 
    When I googled this question all the solutions using terminal either with touch -t or touch -mt commands changed the creation and modification dates, but did not affect the last opened date.
    Anyone have a solution to this?

    Thank you MacNix!!!!!

  • No dates in Last Modified Date or Added Date

    Hello.
    Due to some issues with our servers i'm unable to make any SR's so i hope to recive some answers here instead while that issue gets resolved.
    When looking in the colums "Added Date" and "Last Modified Date" certain activites have no dates there. When attempting to filter all the activities with a filter "Added Date Equals 'Blank' " ie all aktivites who do not have a date in Added Date, the results are 0 activites. I interpret this as the fields are not empty but for some reason the information is not displayed.

    781070 wrote:
    Hello.
    Due to some issues with our servers i'm unable to make any SR's so i hope to recive some answers here instead while that issue gets resolved.
    When looking in the colums "Added Date" and "Last Modified Date" certain activites have no dates there. When attempting to filter all the activities with a filter "Added Date Equals 'Blank' " ie all aktivites who do not have a date in Added Date, the results are 0 activites. I interpret this as the fields are not empty but for some reason the information is not displayed.As far back as I can remember, filtering by either of those fields has never worked.
    There are a number of reasons why the last modified or added date could be blank.

  • How to get last modified date and time of a file which is in apache server.

    Hi ,
    I need to get last modified date and time of a file in remote machine.
    This file is in remote machine which has apache server installed.
    I am trying to get this information by connecting to apache server from client by giving absolute URI of the file to file object.
    URI is got from apache server URL by using toURI method.
    when I use lastModified method , its throwing exception , because scheme of URI is not file.
    I can't give scheme as file because ftp server is not installed on that server
    Is there any other way to get this information .

    No, unless you can use an FTP client.

  • How to find the Last modified date and time of a package

    Hi,
    We need a clarification on how to find the Last modified date and time of a package in Oracle. We used the example below to explain our scenario,
    Lets consider the following example
    Let A, B be two packages.
    Package A calls the package B. So A is dependent on B.
    When A is compiled the TIMESTAMP,LAST_DDL_TIME in USER_OBJECTS gets updated.
    Now there a modification in package B so it is compiled. There is no modification in package A.
    Now when the package A is executed the TIMESTAMP,LAST_DDL_TIME in USER_OBJECTS gets updated but we did not make any change in Package A. Now we need to find last modified date and time of the package A . So we can not rely on the TIMESTAMP,LAST_DDL_TIME in USER_OBJECTS . Can u please tell us any other solution to get last modified date and time of the package A .
    Regards,
    Vijayanand.C

    Here is an example:
    SQL> SELECT OBJECT_NAME,CREATED,LAST_DDL_TIME,TIMESTAMP,STATUS FROM USER_OBJECTS
    2 WHERE OBJECT_NAME = ANY('A','B');
    OBJECT_NAM CREATED LAST_DDL_TIME TIMESTAMP STATUS
    A 20-MAY-2004 10:57:32 20-MAY-2004 10:57:32 2004-05-20:10:57:32 VALID
    B 20-MAY-2004 10:58:22 20-MAY-2004 10:59:04 2004-05-20:10:59:04 VALID
    SQL> CREATE OR REPLACE PROCEDURE A AS
    2 BEGIN
    3 NULL;
    4 NULL;
    5 END;
    6 /
    Procedure created.
    SQL> SELECT OBJECT_NAME,CREATED,LAST_DDL_TIME,TIMESTAMP,STATUS FROM USER_OBJECTS
    2 WHERE OBJECT_NAME = ANY('A','B');
    OBJECT_NAM CREATED LAST_DDL_TIME TIMESTAMP STATUS
    A 20-MAY-2004 10:57:32 20-MAY-2004 11:01:28 2004-05-20:11:01:28 VALID
    B 20-MAY-2004 10:58:22 20-MAY-2004 10:59:04 2004-05-20:10:59:04 INVALID
    SQL> EXEC B
    PL/SQL procedure successfully completed.
    SQL> SELECT OBJECT_NAME,CREATED,LAST_DDL_TIME,TIMESTAMP,STATUS FROM USER_OBJECTS
    2 WHERE OBJECT_NAME = ANY('A','B');
    OBJECT_NAM CREATED LAST_DDL_TIME TIMESTAMP STATUS
    A 20-MAY-2004 10:57:32 20-MAY-2004 11:01:28 2004-05-20:11:01:28 VALID
    B 20-MAY-2004 10:58:22 20-MAY-2004 11:01:53 2004-05-20:11:01:53 VALID
    Note that the date under the column 'created' only changes when you really create or replace the procedure.
    Hence you can use the column 'created' of 'user_objects'.

  • Files last modified date using.

    Is there a way to get the last modifed date of a file residing on a remote machine ?
    I tried the URL class. But could get to the file's contents and not the last modifed date of the file.
    Thank you..

    It depends on how you access the file.
    if the files are in a shared folder you can create a file object for it and get the last modified date.
    If it in a HTTP/FTP server then you should be able to ge the last updated date as a header.

  • Know an extension that searches for the file "last modified" date?

    I am working on a site with 80,000 pages and need to find an
    extension that will search all files within the site and populate
    the date each file was last modified. Know of an extension that
    will assist in this situation? Any ideas will help, thanks in
    advance!

    Ahh, so now your requirements are changing. You do not want a
    simple
    text file output after all, but instead a sortable list. So
    perhaps
    output as a csv that could be sorted within a spreadsheet.
    Altho 80000
    rows?
    It is a bit hard to believe that an organization with an
    80000 page
    website does not have inhouse gurus who could do this in a
    heart beat.
    E. Michael Brandt
    www.divaHTML.com
    divaGPS | divaFAQ
    www.valleywebdesigns.com
    JustSo PictureWindow
    mercuryfenix wrote:
    > I just finished the first scan and was not impressed.
    PageList creates an ugly
    > and nearly useless list of file name, title, path from
    page root, a link to the
    > file, last modified date and time, and some meta
    garbage. To top it all off,
    > you cannot sort it by any of these categories because it
    puts all the data into
    > a lousy html table- useless.
    > I could probably get buy with this, but it would be
    horrible....80,000 pages
    > to scan! O yeah, i forgot to mention it has a very low
    limit to how many files
    > it can scan in one scan!
    >
    > I still am in need of a better extension. Please keep
    helping.
    >

  • Robohelp 10 - Inserting a Last modified date in a topic - how can it be achieved?

    Hi there,
    this is my first post, so apologies if I am in the wrong place...
    I would like to insert a "last modified" date in my topics, but can't figure out how to do this! The Date field inserts today's date whenever the topic is opened, and so doesn't reflect the timeframes of changes accurately.
    I'd appreciate any help on this.
    Thank you
    Caroline

    Hi there
    When you insert the field, look at the options.
    See that option for auto updating? Try clearing it and the field shouldn't auto-populate.
    But note that now the onus is on the help author to ensure they perform the update if they want the date to finally match the current date.
    Cheers... Rick

  • How to find the last modified date of a workflow.

    How to find the last modified date of a workflow.
    thanks.

    Hi,
    There is nothing as standard that does this - you could write some code to determine the latest begin_date from each of the workflow tables and assume that this was the last time that the definition changed.
    What you need is something like this:
    select max(wfa.begin_date)
    from   wf_process_activities  wpa
    ,      wf_activities          wfa
    ,      wf_item_types_tl       wit
    where  wpa.activity_item_type = wfa.item_type
    and    wpa.activity_name      = wfa.name
    and    wfa.version            = (select max(version) from wf_activities wfa1 where wpa.activity_item_type = wfa1.item_type and wpa.activity_name = wfa1.name )
    and    wpa.process_item_type  = 'your item type'
    and    wpa.process_item_type  = wit.namewhich I think gives what you want.
    HTH,
    Matt
    Alpha review chapters from my book "Developing With Oracle Workflow" are available on my website:
    http://www.workflowfaq.com
    http://forum.workflowfaq.com
    NEW! - WorkflowFAQ Blog at http://thoughts.workflowfaq.com

  • Force Crawler in Maint Mode to Ignore Last Modified Data and Re-Index All

    We are running SES 10.1.8.4 with the Siebel 7.8 data source patches 8533402 and 8624308 to index documents (PDF, XLS, DOC, PPT) via RMI and Decompression Tool in Siebel. This data source is virtually identical to the database data source.
    The crawler will not "fail" if the actual indexing of the attachment file itself fails. For example, if RMI is down on the Siebel server and the crawler runs, SES will index the document metadata returned in the SQL but not the document. If the client then starts the RMI utility and re-runs the crawler, the document that was not indexed will not be re-indexed because the data source's last crawl time is used against the data sources last modified date attribute.
    Here is the pseudo SQL for the initial crawler query in maintenance mode....
    SELECT .... FROM MY_VIEW WHERE LASTMODIFIEDATE > TIME OF LAST DATA SOURCE CRAWL
    We have found a way to update the data source's last crawl time (DS_LAST_CRAWL) in the EQ$_DATA_SOURCE table. For now, we simply are using SYSDATE - 1.
    This will allow the missed document to be returned in the initial query.
    However, it's the crawler's document-level last modified date check within the crawler that is preventing the re-index. Since the document's last modified date is the same as what SES has, SES skips over it thinking it has not changed. True, it has not changed but it was missed during the last re-crawl and we want it to be indexed again.
    The client does NOT want to perform a full re-index because of the anticipated volume of attachments.
    Is there any way to tell the crawler to ignore the document-level last modified date and re-index everything returned from the initial query? Perhaps one of the other columns in the EQ$_DATA_SOURCE (DS_STATUS, DS_CRAWLING_MODE) holds the key?
    Thanks!

    I think it might be possible to set ENQUEUE_STATUS = 'Y' in the table EQ_TEST.EQ$URL. You may need to call eq_adm.use_instance(1) before doing so.
    However I'm not sure of the full implications of doing this - DON'T DO IT ON A PRODUCTION SYSTEM without carefully testing on a development system.

Maybe you are looking for