Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give backup progress #47

Open
davedavemckay opened this issue Aug 26, 2024 · 1 comment
Open

Give backup progress #47

davedavemckay opened this issue Aug 26, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@davedavemckay
Copy link
Collaborator

As os.walk returns an Iterator, its length is unknown.
Do a quick os.walk at the beginning to count files and folders and use this to provide a progress percentage.

@davedavemckay davedavemckay added the enhancement New feature or request label Aug 26, 2024
@davedavemckay davedavemckay self-assigned this Aug 26, 2024
@davedavemckay
Copy link
Collaborator Author

%%timeit
folder_count = 0
file_count = 0
for folder, subfolders, files in os.walk(path):
    folder_count += 1
    file_count += len(files)
print(f'Folders: {folder_count}, Files: {file_count}')

Folders: 28, Files: 28360
22.2 ms ± 30.4 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant