Skip to content

Instantly share code, notes, and snippets.

@GrimTheReaper
Last active March 4, 2016 19:23
Show Gist options
  • Save GrimTheReaper/37bb893f0260e8d25d0b to your computer and use it in GitHub Desktop.
Save GrimTheReaper/37bb893f0260e8d25d0b to your computer and use it in GitHub Desktop.
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