Last active
          August 29, 2015 14:26 
        
      - 
      
- 
        Save kishaningithub/203ef354858e9e765bda to your computer and use it in GitHub Desktop. 
Revisions
- 
        kishaningithub revised this gist Aug 1, 2015 . 1 changed file with 13 additions and 2 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ package com.kishan; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -12,7 +14,16 @@ public static void main(String[] args) throws IOException try(Scanner sc = new Scanner(System.in)){ System.out.println("Enter path:"); Path rootPath = Paths.get(sc.nextLine().trim()); System.out.println("Enter extension (.bak):"); String fileExtension = sc.nextLine().trim(); Files.find(rootPath, Integer.MAX_VALUE, (path, basicFileAttrs) -> path.toString().toLowerCase().endsWith(fileExtension.isEmpty() ? ".bak" : fileExtension)).forEach(path -> { try { Files.delete(path); System.out.println("Deleted: " + path.toString()); } catch (Exception e) { e.printStackTrace(); } }); } } } 
- 
        kishaningithub created this gist Aug 1, 2015 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Scanner; public class BakFileDestroyer { public static void main(String[] args) throws IOException { System.out.println("BAK File Destroyer"); try(Scanner sc = new Scanner(System.in)){ System.out.println("Enter path:"); Path rootPath = Paths.get(sc.nextLine().trim()); Files.find(rootPath, Integer.MAX_VALUE, (path, basicFileAttrs) -> path.toString().toLowerCase().endsWith(".bak")).forEach(System.out::println); } } } 
 kishaningithub
              revised
            
            this gist
            
              kishaningithub
              revised
            
            this gist