Boost logo

Boost :

Subject: Re: [boost] [filesystem] How to remove specific files from a directory?
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2016-09-08 03:24:49

On 7 Sep 2016 at 17:45, Andrey Semashev wrote:

> > Indeed, boost::filesystem and std::filesystem (ISO/IEC TS 18822:2015) as well
> > as POSIX readdir behave in the same way.
> > But, for all of them, behaviour is unspecified in case content of
> > directory that is
> > being traversed changes.
> It is unspecified whether the removed/added files will be discovered as
> part of the traversal. Other than that the behavior is defined. For
> instance, the implementation should not crash and the iterator should
> still reach the end at some point.

Be aware that Windows can take quite a bit of time to delete a file,
it happens asynchronously from the syscall. In this situation it's
entirely possible that one could delete every entry in a directory,
yet every entry would still be there. Windows may take until the next
reboot to delete a file, and until then it cannot be opened by

(AFIO v1 took special measures to quietly filter out pending-delete
files. AFIO v2, in line with its new bare metal approach, simply
renames to-be-deleted files to <32 random bytes>.deleted before
requesting deletion)


ned Productions Limited Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at