ultralytics 8.0.161 fix Classify dataset scanning bug (#4515)
This commit is contained in:
parent
3c40e7a9fc
commit
67eeb0468d
4 changed files with 29 additions and 18 deletions
|
|
@ -39,16 +39,17 @@ def is_url(url, check=True):
|
|||
return False
|
||||
|
||||
|
||||
def delete_dsstore(path):
|
||||
def delete_dsstore(path, files_to_delete=('.DS_Store', '__MACOSX')):
|
||||
"""
|
||||
Deletes all ".DS_store" files under a specified directory.
|
||||
|
||||
Args:
|
||||
path (str, optional): The directory path where the ".DS_store" files should be deleted.
|
||||
files_to_delete (tuple): The files to be deleted.
|
||||
|
||||
Example:
|
||||
```python
|
||||
from ultralytics.data.utils import delete_dsstore
|
||||
from ultralytics.utils.downloads import delete_dsstore
|
||||
|
||||
delete_dsstore('path/to/dir')
|
||||
```
|
||||
|
|
@ -58,10 +59,11 @@ def delete_dsstore(path):
|
|||
are hidden system files and can cause issues when transferring files between different operating systems.
|
||||
"""
|
||||
# Delete Apple .DS_store files
|
||||
files = list(Path(path).rglob('.DS_store'))
|
||||
LOGGER.info(f'Deleting *.DS_store files: {files}')
|
||||
for f in files:
|
||||
f.unlink()
|
||||
for file in files_to_delete:
|
||||
matches = list(Path(path).rglob(file))
|
||||
LOGGER.info(f'Deleting {file} files: {matches}')
|
||||
for f in matches:
|
||||
f.unlink()
|
||||
|
||||
|
||||
def zip_directory(directory, compress=True, exclude=('.DS_Store', '__MACOSX'), progress=True):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue