# Issue Regarding The Reporting of Child Files In a Folder After They Are Deleted

**URL:** <https://forum.juce.com/t/issue-regarding-the-reporting-of-child-files-in-a-folder-after-they-are-deleted/21470>\
**Category:** General JUCE discussion\
**Created:** [March 23, 2017, 3:57am UTC](https://forum.juce.com/t/issue-regarding-the-reporting-of-child-files-in-a-folder-after-they-are-deleted/21470 "2017-03-23T03:57:37Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![joe-04-04](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/joe-04-04/32/2566_2.png) [@joe-04-04](https://forum.juce.com/u/joe-04-04)\
**Post date:** [March 24, 2017, 8:35pm UTC](https://forum.juce.com/t/issue-regarding-the-reporting-of-child-files-in-a-folder-after-they-are-deleted/21470/22 "2017-03-24T20:35:31Z")

</div>

I ended up putting the thread::sleep() in the loop and used 15 milliseconds. After adding this, 99 percent of the time it only attempts to move the the file once before it works. This also works on both of my machines.

```
int loopCounter = 0;
const int END_LOOP_AFTER_X_ATTEMPTS = 100;

for(; (loopCounter < END_LOOP_AFTER_X_ATTEMPTS) && (Base::getFileHolder().exists()); loopCounter++)
{
    Base::getFileHolder().moveToTrash();
    Thread::sleep(15);
}

```

I don’t know what the yield offers, as I’m not entirely sure what it does.

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [March 24, 2017, 8:40pm UTC](https://forum.juce.com/t/issue-regarding-the-reporting-of-child-files-in-a-folder-after-they-are-deleted/21470/23 "2017-03-24T20:40:38Z")

</div>

If you have an unknown length of time you can use Thread::wait() and Thread::notify()

Rail

---

<div class="post-metadata">

**Author:** ![joe-04-04](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/joe-04-04/32/2566_2.png) [@joe-04-04](https://forum.juce.com/u/joe-04-04)\
**Post date:** [March 24, 2017, 8:44pm UTC](https://forum.juce.com/t/issue-regarding-the-reporting-of-child-files-in-a-folder-after-they-are-deleted/21470/24 "2017-03-24T20:44:53Z")

</div>

This sounds neat! I’ll fool around with this and see what happens!

I’ve only been using JUCE for about 4 months. It’s so ridiculously large, it’s hard to know what all is possible! Loving it! Definitely will be making a purchase when I’m ready to release some non-open-source stuff!

---

<div class="post-metadata">

**Author:** ![yfede](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yfede/32/506_2.png) [@yfede](https://forum.juce.com/u/yfede)\
**Post date:** [March 27, 2017, 9:17am UTC](https://forum.juce.com/t/issue-regarding-the-reporting-of-child-files-in-a-folder-after-they-are-deleted/21470/25 "2017-03-27T09:17:50Z")

</div>

> [@joe\_04\_04](#):
>
> I don’t know what the yield offers

It’s basically a way for the current thread to give away the rest of its allotted time slot. This will give way to another thread, and the execution of your thread will continue when its turn comes again.

[Previous page](https://forum.juce.com/t/issue-regarding-the-reporting-of-child-files-in-a-folder-after-they-are-deleted/21470.md?page=1)
