Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Non-empty folders cannot be deleted using the smb protocol #16

Open
@zglqaq

Description

in class org.filesys.smb.server.disk.original.JavaFileDiskDriver.deleteDirectory line 267

 String[] fileList = delDir.list();
 if (fileList != null && fileList.length > 0) {
 throw new AccessDeniedException("Directory not empty");
 } else {
 //	Delete the directory
 delDir.delete();
 }

In order to be able to delete non-empty folders directly,I changed the above code to

 String[] fileList = delDir.list();
 if (fileList != null && fileList.length > 0) {
 //throw new AccessDeniedException("Directory not empty"); 
 deleteFolder(delDir); //Recursive deletion
 } else {
 //	Delete the directory
 delDir.delete();
 }
 private static void deleteFolder(File folder) {
 File[] files = folder.listFiles();
 if (files != null) {
 for (File file : files) {
 if (file.isDirectory()) {
 deleteFolder(file);
 } else {
 file.delete();
 }
 }
 }
 folder.delete();
 }

After the modification, the non-empty folder can be successfully deleted on the client.

But when I cut the non-empty folder on the client, the client only cut the empty folder, there is no content in it, and the server folder was completely deleted.

I used the packet capture tool to analyze the data message and found that the client did not send the ReadAndX(0x2e) command
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /