Re: "Sync" sometimes does not delete folders
Earl Hood <[email protected]>
| Newsgroups | gmane.comp.jakarta.ant.user |
|---|---|
| Message-ID | <CANDwYvd28ZcSq3Jhi9HWr3uPqdEiJ+RjCi2BcTJC02xAJUXt0A@mail.gmail.com> |
On Sat, Sep 17, 2016 at 5:05 PM, Al Le wrote: > But sometimes, after the sync, I see that dirs which do not exist on the > share are not deleted on the local file system. Instead, just the files in > the dirs are deleted. > > I still have not been able to track down when exactly it happens. Sometimes > it works as it should (i.e. the dir is deleted), but sometimes it does not. Since you mentioned Windows, it is likely that the OS may still have a "lock" on the directory, so any delete operation will fail. Windows does not allow one to delete a file if there is a process that has an open handle to it, and if a directory, an open handle to a file within it. I believe there are race conditions within Windows on when a process closes a handle and when Windows actually releases the handle. This could be what is happening. If you have AV software running, it could be a factor. Without examining the source of the sync task itself, unknown if operation order can be modified to minimize the problem. I do not know if the sync task checks if file deletions actually succeed. It is common for Java programs to not check the return value of a delete operation (File#delete()) to verify it actually worked. --ewh