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

!636
!standard functions

main {
  psvm {
    File javax = new File(System.getProperty("user.home"), ".javax");
    long now = System.currentTimeMillis();
    for (File dir : javax.listFiles()) {
      if (dir.isDirectory() && Pattern.compile("\\d+").matcher(dir.getName()).matches()) {
        long time = Long.parseLong(dir.getName());
        long seconds = (now-time)/1000;
        long minutes = seconds/60;
        long hours = minutes/60;
        if (hours >= 1) {
          System.out.println("Can delete " + dir.getAbsolutePath() + ", age: " + hours + " h"); 
        }
      }
    }
  }
}

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: 688 / 547
Referenced in: [show references]