HaOx
HaOx

Reputation: 1879

Delete files according to create date

I want to delete the files which were created today. So how I could do this?

Upvotes: 1

Views: 721

Answers (1)

ihrupin
ihrupin

Reputation: 6972

   File f = new File("somefile.txt");

   if(f.lastModified() > DAY_START && f.lastModified() < DAY_END){
        f.delete();
    }

WHERE

DAY_START - long value of day start time

DAY_END - long value of day end time

HOPE it help you!!!

Upvotes: 1

Related Questions