Java Program delete files in directory also include subdirectory

Discussion in 'Java' started by moon, Sep 20, 2005.

  1. moon

    moon Guest

    How to write a java program to delete files in directory also include
    subdirectory since modified n days ago ?
    like UNIX find command

    find /tmp -name '*.prn' -mtime +30 -print -exec rm {}
    moon, Sep 20, 2005
    #1
    1. Advertising

  2. moon

    Roedy Green Guest

    On Tue, 20 Sep 2005 16:14:34 +0800, "moon" <>
    wrote or quoted :

    >How to write a java program to delete files in directory also include
    >subdirectory since modified n days ago ?
    >like UNIX find command


    File.list and File.isDirectory. You write recursive delete.
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
    Roedy Green, Sep 20, 2005
    #2
    1. Advertising

  3. moon wrote:
    > How to write a java program to delete files in directory also include
    > subdirectory since modified n days ago ?
    > like UNIX find command
    >
    > find /tmp -name '*.prn' -mtime +30 -print -exec rm {}
    >
    >


    You might also want to look at the ant API. See class
    org.apache.tools.ant.taskdefs.Delete .
    Abhijat Vatsyayan, Sep 20, 2005
    #3
  4. Roedy Green wrote:
    >>How to write a java program to delete files in directory also include
    >>subdirectory since modified n days ago ?
    >>like UNIX find command

    >
    > File.list and File.isDirectory.

    and File.lastModified and System.currentTimeMillis

    > You write recursive delete.
    Thomas Fritsch, Sep 20, 2005
    #4
    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. Loane Sharp
    Replies:
    1
    Views:
    761
    Bernard Cheah [MVP]
    Apr 24, 2006
  2. Fuzzyman
    Replies:
    1
    Views:
    256
    F. GEIGER
    Feb 13, 2004
  3. Casey Hawthorne
    Replies:
    1
    Views:
    466
    Robert Klemme
    Oct 27, 2006
  4. copx

    #include from a subdirectory

    copx, Dec 4, 2004, in forum: C Programming
    Replies:
    5
    Views:
    502
    Joe Wright
    Dec 4, 2004
  5. lofenee
    Replies:
    3
    Views:
    122
    Ben Bullock
    Apr 22, 2008
Loading...

Share This Page