├── .gitignore ├── src └── hamid │ ├── main.css │ ├── Main.java │ ├── CustomFileVisitor.java │ ├── main.fxml │ ├── Controller.java │ └── DefaultFileVisitor.java ├── out ├── artifacts │ └── File_Organizer │ │ ├── File_Organizer.jar │ │ ├── File_Organizer.jnlp │ │ └── File_Organizer.html └── production │ └── File Organizer │ └── hamid │ ├── Main.class │ ├── main.css │ ├── Controller.class │ ├── CustomFileVisitor.class │ ├── DefaultFileVisitor.class │ └── main.fxml ├── File Organizer.iml ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | /out/artifacts/File_Organizer.html 3 | /out/artifacts/File_Organizer.jnlp -------------------------------------------------------------------------------- /src/hamid/main.css: -------------------------------------------------------------------------------- 1 | .text{ 2 | -fx-font-size: 20px; 3 | -fx-font-weight: bold; 4 | } 5 | .root { 6 | -fx-background-color: #7fffd4; 7 | } -------------------------------------------------------------------------------- /out/artifacts/File_Organizer/File_Organizer.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inventionsbyhamid/File-Organizer/HEAD/out/artifacts/File_Organizer/File_Organizer.jar -------------------------------------------------------------------------------- /out/production/File Organizer/hamid/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inventionsbyhamid/File-Organizer/HEAD/out/production/File Organizer/hamid/Main.class -------------------------------------------------------------------------------- /out/production/File Organizer/hamid/main.css: -------------------------------------------------------------------------------- 1 | .text{ 2 | -fx-font-size: 20px; 3 | -fx-font-weight: bold; 4 | } 5 | .root { 6 | -fx-background-color: #7fffd4; 7 | } -------------------------------------------------------------------------------- /out/production/File Organizer/hamid/Controller.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inventionsbyhamid/File-Organizer/HEAD/out/production/File Organizer/hamid/Controller.class -------------------------------------------------------------------------------- /out/production/File Organizer/hamid/CustomFileVisitor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inventionsbyhamid/File-Organizer/HEAD/out/production/File Organizer/hamid/CustomFileVisitor.class -------------------------------------------------------------------------------- /out/production/File Organizer/hamid/DefaultFileVisitor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inventionsbyhamid/File-Organizer/HEAD/out/production/File Organizer/hamid/DefaultFileVisitor.class -------------------------------------------------------------------------------- /File Organizer.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # File-Organizer 2 | Organize files in any directory by classifying them into different folders.
3 | This project is inspired by https://github.com/bhrigu123/classifier. 4 | 5 | ## Requirements 6 | * Java Runtime Environment 7 | 8 | ##Installation 9 | * Download the jar [File_Organizer.jar](https://www.dropbox.com/s/weanvnxap6s0080/File_Organizer.jar?dl=1) 10 | * Double click to run 11 | 12 | ##Usage 13 | Default: 14 | * Select folder to organize clcik Organize button to classify files in Music,Archives,Documents,Pictures,Videos 15 | 16 | Custom: 17 | * Enter the folder name and then extension list separated by commas. Example html,css,js 18 | 19 | ####Note: Extensions should not contain the "." prefix. 20 | ![Using File Organizer](https://www.dropbox.com/s/1mrsasy4ofzdo3v/FileOrganizer.gif?dl=1 "Using File Organizer") 21 | 22 | ##TODO: 23 | * Separate moving files code in separate background thread. 24 | -------------------------------------------------------------------------------- /src/hamid/Main.java: -------------------------------------------------------------------------------- 1 | package hamid; 2 | 3 | import javafx.application.Application; 4 | import javafx.fxml.FXML; 5 | import javafx.fxml.FXMLLoader; 6 | import javafx.scene.Parent; 7 | import javafx.scene.Scene; 8 | import javafx.scene.text.Text; 9 | import javafx.stage.Stage; 10 | 11 | public class Main extends Application { 12 | @FXML private Text done; 13 | 14 | 15 | @Override 16 | public void start(Stage primaryStage) throws Exception{ 17 | Parent root = FXMLLoader.load(getClass().getResource("main.fxml")); 18 | primaryStage.setTitle("File Organizer by Hamid"); 19 | Scene scene = new Scene(root); 20 | primaryStage.setScene(scene); 21 | scene.getStylesheets().add(getClass().getResource("main.css").toExternalForm()); 22 | //done.setFont(new Font(20.0)); 23 | primaryStage.show(); 24 | } 25 | 26 | 27 | public static void main(String[] args) { 28 | launch(args); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /out/artifacts/File_Organizer/File_Organizer.jnlp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Sample JavaFX Application 5 | Hamid Siddiqui 6 | Sample JavaFX 2.0 application. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Hamid Siddiqui 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /out/artifacts/File_Organizer/File_Organizer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | 17 | 36 | 37 | 38 |

Test page for File Organizer

39 | Webstart: click to launch this app as webstart


40 | 41 | 42 |
43 | 44 | -------------------------------------------------------------------------------- /src/hamid/CustomFileVisitor.java: -------------------------------------------------------------------------------- 1 | package hamid; 2 | 3 | import java.io.IOException; 4 | import java.nio.file.*; 5 | import java.nio.file.attribute.BasicFileAttributes; 6 | import java.util.Arrays; 7 | import java.util.HashSet; 8 | 9 | /** 10 | * Created by Hamid on 1/29/2016. 11 | */ 12 | 13 | class CustomFileVisitor extends SimpleFileVisitor { 14 | 15 | 16 | private String extensions[] = null; 17 | private Path newFilePath; 18 | protected CustomFileVisitor(String source,String[] extensions,String folderName) { 19 | super(); 20 | newFilePath = Paths.get(source,folderName); 21 | this.extensions = extensions; 22 | } 23 | 24 | @Override 25 | public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)throws IOException{ 26 | 27 | 28 | String filename = file.getFileName().toString(); 29 | int extensionpos = filename.lastIndexOf('.'); 30 | String extension = filename.substring(extensionpos+1).toLowerCase(); 31 | if(Files.notExists(newFilePath)) 32 | Files.createDirectories(newFilePath); 33 | if(extensions==null) 34 | System.out.println("No extensions"); 35 | for(String ex: extensions) { 36 | if(ex.equals(extension)) 37 | try { 38 | Files.move(file, newFilePath.resolve(filename)); 39 | } 40 | catch(IOException e) { 41 | System.out.println("File not moved "+ file); 42 | System.out.println("Error "+ e.getMessage()); 43 | System.out.println("Cause of not moving "+ e.getCause()); 44 | } 45 | } 46 | 47 | return FileVisitResult.CONTINUE; 48 | } 49 | 50 | @Override 51 | public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { 52 | System.out.println("Directory visiting " + dir); 53 | return FileVisitResult.CONTINUE; 54 | } 55 | 56 | @Override 57 | public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { 58 | System.out.println("File visit failed" + file); 59 | return FileVisitResult.CONTINUE; 60 | } 61 | 62 | @Override 63 | public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { 64 | System.out.println("Directory finish " + dir); 65 | return FileVisitResult.CONTINUE; 66 | } 67 | } 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /src/hamid/main.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 18 | 22 | 23 |