javafilesystemscifs

Quick delete remote directory


We writed java program, it deletes directory on some shared network disc. But it is very slow. It uses recursion for directories deletion (in function commons-io FileUtils.deleteDirectory). But I think recursion is slow, because there is a lot of network communication.

Is some way, how to delete directory with content by one "command"?


Solution

  • We use commands

    del /f/s/q foldername > nul

    rmdir /s/q foldername

    on Windows, i.e. we call theese commands from Java.

    See What's the fastest way to delete a large folder in Windows?

    It isn't too nice, but it works :-).