Skip to content

Commit

Permalink
Moved to gradle build system, and provided flags to perform search or…
Browse files Browse the repository at this point in the history
… delete

* --find <path1> <path2>...
* --delete <file-with-paths-to-delete>
  • Loading branch information
krrishnaaaa committed Oct 13, 2024
1 parent c8793b5 commit a81c601
Show file tree
Hide file tree
Showing 15 changed files with 661 additions and 280 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea/
.gradle/
*.iml
build/
toDelete
.DS_Store
54 changes: 0 additions & 54 deletions Deletion.java

This file was deleted.

23 changes: 0 additions & 23 deletions DuplicateDetails.java

This file was deleted.

43 changes: 0 additions & 43 deletions Files.java

This file was deleted.

156 changes: 0 additions & 156 deletions ListFiles.java

This file was deleted.

9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ How to use this?
Step 6: After processing is completed a file will be generated with list of
duplicate files. Open the file and REMOVE THE ENTRIES WHICH YOU WANT TO KEEP.
Step 7: Run 'java Deletion <file-location>`

Now it will delete all those files listed in `toDelete` file.

NOTE:
1. File once deleted cannot be recovered. They will be deleted permanently.
So, be careful while using `Deletion`.
2. Whenever you want to escape press <ctrl>+c [^c] to exit.

Java source code to search a directory, recursively, for duplicate files. Well, this code is not commented, but feel
free to query.

Java source code to search a directory, recursively, for duplicate files. Well, this code is not commented, but feel free to query.

Feel free to reorganize code, and distribute your own version. I would be happy if you could state your name and application, in which this code is used.
Feel free to reorganize 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 following details:

Expand Down
41 changes: 41 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
plugins {
kotlin("jvm") version "1.9.10"
application
id("com.github.johnrengelman.shadow") version "8.1.1"
}

group = "com.example"
version = "1.0-SNAPSHOT"

repositories {
mavenCentral()
}

sourceSets {
main {
kotlin.srcDirs("src/main/kotlin")
resources.srcDirs("src/main/resources")
}
}
dependencies {
implementation(kotlin("stdlib"))
}

application {
mainClass.set("com.pcsalt.utility.MainKt") // Main class path
}

tasks.jar {
manifest {
attributes["Main-Class"] = "com.pcsalt.utility.MainKt"
}
from(sourceSets.main.get().output)
}

tasks {
shadowJar {
archiveBaseName.set("search-and-delete-duplicates")
archiveClassifier.set("")
archiveVersion.set("1.0-SNAPSHOT")
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kotlin.code.style=official
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit a81c601

Please sign in to comment.