Repository: PrefectHQ/prefect

Issue:
Hidden files are not uploaded to remote storage
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Prefect documentation for this issue.
- [X] I checked that this issue is related to Prefect and not one of its dependencies.

### Bug summary

When using `RemoteFileSystem` as deployment storage block hidden files (filenames starting with a period) do not get uploaded.
This is the [line](https://github.com/PrefectHQ/prefect/blob/51e92dda965431c5f1beb486f0bcc4058035a868/src/prefect/filesystems.py#L345) that filters them out.
`glob.glob` does not list hidden files by default ([ref](https://docs.python.org/3/library/glob.html)).

```shell
touch .hidden
python -c 'import glob; print(glob.glob("./**", recursive=True))'
# ['./']
python -c 'import glob; print(glob.glob("./.**", recursive=True))'
# ['./.hidden']
```

### Reproduction

```python3
1. Create a file with filename that starts with a `.`
2. Create a deployment from a folder that contains the hidden file and uses RemoteFileSystem as storage
3. File is not uploaded
```


### Error

_No response_

### Versions

```Text
Version:             2.6.4+13.g6d567ec3b
API version:         0.8.2
Python version:      3.10.6
Git commit:          6d567ec3
Built:               Mon, Oct 24, 2022 12:38 PM
OS/Arch:             linux/x86_64
Profile:             default
Server type:         ephemeral
Server:
  Database:          sqlite
  SQLite version:    3.34.1
```


### Additional context

_No response_


Discussion:
Thanks for the report! Seems like we ought to include hidden files by default.

Resolving patch:
diff --git a/src/prefect/filesystems.py b/src/prefect/filesystems.py
--- a/src/prefect/filesystems.py
+++ b/src/prefect/filesystems.py
@@ -1,13 +1,11 @@
 import abc
-import glob
 import io
 import json
-import os
 import shutil
 import sys
 import urllib.parse
 from distutils.dir_util import copy_tree
-from pathlib import Path, PurePath
+from pathlib import Path
 from tempfile import TemporaryDirectory
 from typing import Any, Dict, Optional, Tuple, Union
 
@@ -342,8 +340,8 @@ async def put_directory(
             )
 
         counter = 0
-        for f in glob.glob(os.path.join(local_path, "**"), recursive=True):
-            relative_path = PurePath(f).relative_to(local_path)
+        for f in Path(local_path).rglob("*"):
+            relative_path = f.relative_to(local_path)
             if included_files and str(relative_path) not in included_files:
                 continue
 
@@ -352,9 +350,10 @@ async def put_directory(
             else:
                 fpath = to_path + "/" + relative_path.as_posix()
 
-            if Path(f).is_dir():
+            if f.is_dir():
                 pass
             else:
+                f = f.as_posix()
                 if overwrite:
                     self.filesystem.put_file(f, fpath, overwrite=True)
                 else:


Test patch:
diff --git a/tests/test-projects/tree-project/.hidden b/tests/test-projects/tree-project/.hidden
new file mode 100644
diff --git a/tests/test_filesystems.py b/tests/test_filesystems.py
--- a/tests/test_filesystems.py
+++ b/tests/test_filesystems.py
@@ -143,6 +143,7 @@ async def test_put_directory_tree(self):
             "/tree/shared_libs",
             "/tree/shared_libs/bar.py",
             "/tree/shared_libs/foo.py",
+            "/tree/.hidden",
         }
 
     async def test_put_directory_put_file_count(self):