Skip to content

Instantly share code, notes, and snippets.

@ypetya
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save ypetya/57dc360e89a8edac364c to your computer and use it in GitHub Desktop.

Select an option

Save ypetya/57dc360e89a8edac364c to your computer and use it in GitHub Desktop.
Removes a windows gift... the too deep file system with java nio
package testapps.uncategorised;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class DeleteLongFilePathOnWindows {
String toRemove;
DeleteLongFilePathOnWindows(String rootDirToRemove) {
toRemove = rootDirToRemove;
}
public static void main(String[] args) throws IOException {
for (String arg : args) {
new DeleteLongFilePathOnWindows(arg).rmRec();
}
}
private void rmRec() throws IOException {
try {
rmRec(toRemove);
} catch (Exception ex) {
Logger.getGlobal().log(Level.SEVERE, "err", ex);
throw ex;
}
}
private void rmRec(String dir) throws IOException {
File f = new File(dir);
if (f.isDirectory()) {
for (String s : f.list()) {
if (!"..".equals(s) && !".".equals(s)) {
try {
rmRec(f.getCanonicalPath() + File.separator + s);
} catch (Exception iox) {
Logger.getGlobal().log(Level.SEVERE, "could not delete", iox);
throw iox;
}
}
}
}
java.nio.file.Files.delete(f.toPath());
}
}

Registry options

HKLM

IE 9

  • Disable script debugger settings

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main ...

  • Enabling history or delete cache buttons

HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Control Panel HKEY_Local_Machine\Software\Policies\Microsoft\Internet Explorer\Control Panel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment