Repository: Flexget/Flexget

Issue:
Unhandled error in plugin exists: 'PosixPath' object has no attribute 'walk'
<!---
Before opening an issue, verify:

- Is this a feature request? Post it on https://feathub.com/Flexget/Flexget
- Did you recently upgrade? Look at the Change Log and Upgrade Actions to make sure that you don't need to make any changes to your config https://flexget.com/ChangeLog https://flexget.com/UpgradeActions
- Are you running FlexGet as a daemon? Stop it completely and then start it again https://flexget.com/CLI/daemon
- Did you search to see if the issue already exists? https://github.com/Flexget/Flexget/issues
- Did you fill out the issue template as completely as possible?

The issue template is here because it helps to ensure you submitted all the necessary information the first time, and allows us to more quickly review issues. Please fill it out correctly and do not ignore it, no matter how irrelevant you think it may be. Thanks in advance for your help with this!
--->

### Expected behaviour:
After daemon startup, tasks are run without errors
<!---
Please don't just say "it doesn't crash" or "it works". Explain what the expected result is.
--->

### Actual behaviour:
Tasks are aborted
### Steps to reproduce:
- Step 1: Configure exists plugin
- Step 2: Run flexget

#### Config:
AFAIR, any config using exists plugin
  
#### Log:
<details>
 <summary>(click to expand)</summary>

```
2019-11-13 20:32 CRITICAL task          tv_rarbg        BUG: Unhandled error in plugin exists: 'PosixPath' object has no attribute 'walk'
Traceback (most recent call last):
  File "/home/carno/envs/flexget3/lib/python3.7/site-packages/flexget/task.py", line 520, in __run_plugin
    result = method(*args, **kwargs)
  File "/home/carno/envs/flexget3/lib/python3.7/site-packages/flexget/event.py", line 20, in __call__
    return self.func(*args, **kwargs)
  File "/home/carno/envs/flexget3/lib/python3.7/site-packages/flexget/plugins/filter/exists.py", line 41, in on_task_filter
    for p in folder.walk(errors='ignore'):
AttributeError: 'PosixPath' object has no attribute 'walk'

```
</details>

### Additional information:

- FlexGet version: 3.0.1
- Python version: 3.7.2
- Installation method: pip
- Using daemon (yes/no): yes
- OS and version: debian unstable
- Link to crash log: N/A

<!---
In config and debug/crash logs, remember to redact any personal or sensitive information such as passwords, API keys, private URLs and so on.

Please verify that the following data is present before submitting your issue:

- Link to a paste service or paste above the relevant config (preferably full config, including templates if present). Please make sure the paste does not expire, if possible.
- Link to a paste service or paste above debug-level logs of the relevant task/s (use `flexget -L debug execute --tasks <Task_name>`).
- FlexGet version (use `flexget -V` to get it).
- Full Python version, for example `2.7.11` (use `python -V` to get it). 
- Installation method (pip, git install, etc).
- Whether or not you're running FlexGet as a daemon.
- OS and version.
- Attach crash log if one was generated, in addition to the debug-level log. It can be found in the directory with your config file.
--->



Discussion:

Resolving patch:
diff --git a/flexget/plugins/filter/exists.py b/flexget/plugins/filter/exists.py
--- a/flexget/plugins/filter/exists.py
+++ b/flexget/plugins/filter/exists.py
@@ -38,12 +38,13 @@ def on_task_filter(self, task, config):
             folder = Path(folder).expanduser()
             if not folder.exists():
                 raise plugin.PluginWarning('Path %s does not exist' % folder, log)
-            for p in folder.walk(errors='ignore'):
-                key = p.name
-                # windows file system is not case sensitive
-                if platform.system() == 'Windows':
-                    key = key.lower()
-                filenames[key] = p
+            for p in folder.rglob('*'):
+                if p.is_file():
+                    key = p.name
+                    # windows file system is not case sensitive
+                    if platform.system() == 'Windows':
+                        key = key.lower()
+                    filenames[key] = p
         for entry in task.accepted:
             # priority is: filename, location (filename only), title
             name = Path(entry.get('filename', entry.get('location', entry['title']))).name


Test patch: