Automatically delete files after a certain date

Discussion in 'Java' started by Allan Martin, Jul 5, 2004.

  1. Allan Martin

    Allan Martin Guest

    Hello,

    Can anyone point me in the right direction to write a java program
    which will delete some directories in a specific windows directory
    after they are more the 14 days old.

    Many thanks in advance,

    Allan
    Allan Martin, Jul 5, 2004
    #1
    1. Advertising

  2. Allan Martin wrote:

    > Hello,
    >
    > Can anyone point me in the right direction to write a java program
    > which will delete some directories in a specific windows directory
    > after they are more the 14 days old.
    >
    > Many thanks in advance,
    >
    > Allan


    http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html

    Look at

    File.listFiles()
    File.lastModified()
    File.delete()

    --
    Kind regards,
    Christophe Vanfleteren
    Christophe Vanfleteren, Jul 5, 2004
    #2
    1. Advertising

  3. Allan Martin

    Roedy Green Guest

    On 5 Jul 2004 03:52:55 -0700, (Allan Martin)
    wrote or quoted :

    >Can anyone point me in the right direction to write a java program
    >which will delete some directories in a specific windows directory
    >after they are more the 14 days old.


    See http://mindprod.com/jgloss/file.html
    to get a list of files in a directory and how to find out how old they
    are and how to delete them. put it all together ... 14 days is 14 *
    24 * 60 * 60 * 1000 millis.


    see also http://mindprod.com/jgloss/filter.html for how to write a
    Filter to let through only such files.

    You might want to use the Recent filter part of my collection of
    filters at http://mindprod.com/products.html#FILTER

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    Roedy Green, Jul 5, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,178
    Michael Borgwardt
    May 30, 2004
  2. Replies:
    0
    Views:
    633
  3. gary
    Replies:
    13
    Views:
    591
    =?ISO-8859-15?Q?Juli=E1n?= Albo
    Nov 5, 2005
  4. subhadip
    Replies:
    0
    Views:
    613
    subhadip
    Mar 28, 2007
  5. Replies:
    4
    Views:
    340
Loading...

Share This Page