Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

20
LINES

< > BotCompany Repo | #1000379 // Find old cache files (~.javax)

JavaX translator

1  
!636
2  
!standard functions
3  
4  
main {
5  
  psvm {
6  
    File javax = new File(System.getProperty("user.home"), ".javax");
7  
    long now = System.currentTimeMillis();
8  
    for (File dir : javax.listFiles()) {
9  
      if (dir.isDirectory() && Pattern.compile("\\d+").matcher(dir.getName()).matches()) {
10  
        long time = Long.parseLong(dir.getName());
11  
        long seconds = (now-time)/1000;
12  
        long minutes = seconds/60;
13  
        long hours = minutes/60;
14  
        if (hours >= 1) {
15  
          System.out.println("Can delete " + dir.getAbsolutePath() + ", age: " + hours + " h"); 
16  
        }
17  
      }
18  
    }
19  
  }
20  
}

Author comment

supersedes #2000473

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1000379
Snippet name: Find old cache files (~.javax)
Eternal ID of this version: #1000379/1
Text MD5: 9b7c7e98be2906e63996c23e2393dd2e
Author: stefan
Category:
Type: JavaX translator
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-07-31 00:52:41
Source code size: 617 bytes / 20 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 692 / 551
Referenced in: [show references]