Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
I unarchived in the wrong folder and since I know java better than batch (it first happened on windows) i wrote this to deal with it (rewritten on my phone out of boredum).
public class main {
public static void main(String[] args) {
resonate("/home/user/Pictures/Archives","/home/user/Pictures");
}
public static void resonate(String lists, String reduce){
File f1 = new File(lists);
if (f1.exists() && f1.isDirectory()){
for (File f2: f1.listFiles()){
File f3 = new File(reduce+"/"+f2.getName());
if (f3.isFile() && f3.exists()){
if (f3.delete()){
Print("Deleted "+f2.getName());
}else{
Print("Failed to delete "+f2.getName());
}
}
}
}else{
Print("Invalid Input!");
}
}
public static void Print(String s){
System.out.println(s);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.