This tool scans specified directories for duplicate files, automatically excluding common project and system directories. It helps users reclaim disk space by identifying and removing redundant files with ease.
- JDK 17 must be installed.
- Path environments must be set.
Follow the steps to use it:
- Download the JAR file:
search-and-delete-duplicates-1.0-SNAPSHOT.jar
. - Open
Terminal
orCommand Prompt
. - Run the command to find duplicates:
java -jar search-and-delete-duplicates-1.0-SNAPSHOT.jar --find <root-directory-to-search-duplicate-entries>
- After processing is completed, a file will be generated with a list of duplicate files. Open the file and REMOVE THE ENTRIES WHICH YOU WANT TO KEEP.
- To delete the files listed in the
toDelete
file, run:java -jar search-and-delete-duplicates-1.0-SNAPSHOT.jar --delete <file-location>
java -jar search-and-delete-duplicates-1.0-SNAPSHOT.jar --find <directory1> <directory2> [...]
java -jar search-and-delete-duplicates-1.0-SNAPSHOT.jar --delete <file>
java -jar search-and-delete-duplicates-1.0-SNAPSHOT.jar --find ~/dir1 ~/dir2
java -jar search-and-delete-duplicates-1.0-SNAPSHOT.jar --delete toDelete.txt
- File once deleted cannot be recovered. They will be deleted permanently. So, be careful while using
Deletion
. - Whenever you want to escape, press
<ctrl>+c
[^c] to exit.
When the program searches for duplicate files, it ignores specific directories and files to streamline the process and avoid unnecessary scanning of commonly used directories.
The following directories are excluded from the search:
- .git: This directory is used for version control by Git, and its contents are not relevant to duplicate file searching.
- build: This directory often contains compiled files generated during the build process, which are not considered duplicates.
- node_modules: This directory is used by Node.js projects to store dependencies and is typically large, so it is ignored.
- .gradle: This directory contains Gradle-specific files and caches, which do not need to be scanned.
- .idea: This directory is used by JetBrains IDEs (like IntelliJ IDEA) to store project-specific settings and configurations.
The program also ignores the following file:
- .DS_Store: This is a file created by macOS to store custom attributes of a folder, and it is not useful for the duplicate file search.
By excluding these directories and files, the program focuses on relevant files, enhancing performance and accuracy.
Feel free to reorganize the code and distribute your own version. I would be happy if you could state your name and application in which this code is used.
Send email with the following details:
- To: krishna[at]pcsalt[dot]com
- Subject: [Search-and-Delete-duplicate-files]
- Message: [your-text]
Thank you.
Copyright 2014 Krrishnaaaa
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Apache License 2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.