An application that can be used to compare files between two or more directories. It will search for duplicated files using a hash MD5 to compare each file.
So, this is a desktop application created with Electron and AngularJS/Twitter Bootstrap to show an interface and a REST API provided by Spring Boot written in Java to serves a back-end application.
I say that is a proof of concept, that an desktop application really can be built with HTML5, Javascript, CSS and a lot of web technologies.
Feel free to use this project as an inception to your new project. and please, give me a star by this great job =).
We are assuming that will have installed in your OS:
- the Git;
- the JDK 8 with Maven 3.3.x;
- the NodeJS with NPM.
So, type the following in your terminal to download the source code and run this project.
git clone https://github.com/jpcercal/duplicated-files.git
cd duplicated-files/
mvn clean package
npm install
bower install
grunt
Now, you are able to start the application.
npm start
That is all folks, you will see a splash screen and the application. =).
Well, you can see below the HTTP routes where this application will handle your requests.
- Post /api/duplicated-files/ will search for duplicated files given the directories.
- Delete /api/remove-files will move the files (that was selected previously) to OS trash.
Your request must have:
- An endpoint
/api/duplicated-files/
using the HTTP verbPOST
; - A header
Content-Type: application/json
; - A body filled with a JSON string, like this (if you are using Windows):
{
"directories": [
"C:\\Users\\jcercal\\Desktop\\comparator\\folder1",
"C:\\Users\\jcercal\\Desktop\\comparator\\folder2"
]
}
And as result, you will receive a response like this (that contains the duplicated files that was found grouped by the hash md5):
{
"deea68e90a44a5a352c711f6551ab4b1":[
{
"path":"C:\\Users\\jcercal\\Desktop\\comparator\\folder1\\2.jpg",
"name":"2.jpg",
"parent":"C:\\Users\\jcercal\\Desktop\\comparator\\folder1",
"absolute":true,
"absoluteFile":"C:\\Users\\jcercal\\Desktop\\comparator\\folder1\\2.jpg",
"absolutePath":"C:\\Users\\jcercal\\Desktop\\comparator\\folder1\\2.jpg",
"directory":false,
"file":true,
"hidden":false,
"metadata":{
"size":"49.94 KB",
"mime":"image/jpeg",
"width":"637px",
"type":"jpg",
"md5":"deea68e90a44a5a352c711f6551ab4b1",
"height":"450px"
}
},
{
"path":"C:\\Users\\jcercal\\Desktop\\comparator\\folder2\\2.jpg",
"name":"2.jpg",
"parent":"C:\\Users\\jcercal\\Desktop\\comparator\\folder2",
"absolute":true,
"absoluteFile":"C:\\Users\\jcercal\\Desktop\\comparator\\folder2\\2.jpg",
"absolutePath":"C:\\Users\\jcercal\\Desktop\\comparator\\folder2\\2.jpg",
"directory":false,
"file":true,
"hidden":false,
"metadata":{
"size":"49.94 KB",
"mime":"image/jpeg",
"width":"637px",
"type":"jpg",
"md5":"deea68e90a44a5a352c711f6551ab4b1",
"height":"450px"
}
}
]
}
Your request must have:
- An endpoint
/api/remove-files/
using the HTTP verbDELETE
; - A header
Content-Type: application/json
; - A body filled with a JSON string, like this (if you are using Windows):
{
"duplicatedFiles":{
"deea68e90a44a5a352c711f6551ab4b1":[
{
"path":"C:\\Users\\jcercal\\Desktop\\comparator\\folder2\\2.jpg",
"name":"2.jpg",
"parent":"C:\\Users\\jcercal\\Desktop\\comparator\\folder2",
"absolute":true,
"absoluteFile":"C:\\Users\\jcercal\\Desktop\\comparator\\folder2\\2.jpg",
"absolutePath":"C:\\Users\\jcercal\\Desktop\\comparator\\folder2\\2.jpg",
"directory":false,
"file":true,
"hidden":false,
"metadata":{
"size":"49.94 KB",
"mime":"image/jpeg",
"width":"637px",
"type":"jpg",
"md5":"deea68e90a44a5a352c711f6551ab4b1",
"height":"450px"
}
}
]
}
}
And as result, you will receive a response with HTTP Status Code 204 with no content.
If you liked of this project, give me a star =).
- Give me a star =)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Make your changes
- Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request