diff --git a/java/meterpreter/stdapi/src/main/java/com/metasploit/meterpreter/stdapi/stdapi_fs_delete_dir_V1_7.java b/java/meterpreter/stdapi/src/main/java/com/metasploit/meterpreter/stdapi/stdapi_fs_delete_dir_V1_7.java index a52dea3a3..24c5c0a55 100644 --- a/java/meterpreter/stdapi/src/main/java/com/metasploit/meterpreter/stdapi/stdapi_fs_delete_dir_V1_7.java +++ b/java/meterpreter/stdapi/src/main/java/com/metasploit/meterpreter/stdapi/stdapi_fs_delete_dir_V1_7.java @@ -7,7 +7,11 @@ public class stdapi_fs_delete_dir_V1_7 extends stdapi_fs_delete_dir { @Override protected boolean deleteSymlink(File file) throws IOException { - Files.delete(file.toPath()); - return true; + String osName = System.getProperty("os.name"); + if (osName != null && osName.toLowerCase().contains("windows")) { + Files.delete(file.toPath()); + return true; + } + return file.delete(); } }