2 Replies Latest reply on Nov 11, 2011 4:31 PM by maheshguruswamy

    file deletion using creation date

    788437
      Hi,

      I have to delete files in a directory using creation date of files to get how older they are with reference to current date.Any suggestion...

      Thanks in advance
        • 1. Re: file deletion using creation date
          gimbal2
          Creation date? I'm sorry but the File object provides only the last modified date. You can get it as a date using:
          File file = new File("bla.bla");
          Date lastModified = new Date(file.lastModified());
          I wonder if the NIO package can provide more information, I'm not too familiar with it.
          • 2. Re: file deletion using creation date
            maheshguruswamy
            gimbal2 wrote:
            Creation date? I'm sorry but the File object provides only the last modified date. You can get it as a date using:
            File file = new File("bla.bla");
            Date lastModified = new Date(file.lastModified());
            I wonder if the NIO package can provide more information, I'm not too familiar with it.
            Yeah, seems like Java 7 has it. http://download.oracle.com/javase/7/docs/api/java/nio/file/attribute/BasicFileAttributes.html#creationTime()