BUCH 1.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- BUCH.py +26 -0
- buch-1.0.2.dist-info/METADATA +23 -0
- buch-1.0.2.dist-info/RECORD +5 -0
- buch-1.0.2.dist-info/WHEEL +5 -0
- buch-1.0.2.dist-info/top_level.txt +1 -0
BUCH.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
|
|
4
|
+
__version__ = "1.0.0"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def can_backup(path, copies=1):
|
|
8
|
+
if not os.path.exists(path):
|
|
9
|
+
raise FileNotFoundError(f"Path not found: {path}")
|
|
10
|
+
|
|
11
|
+
if os.path.isfile(path):
|
|
12
|
+
size = os.path.getsize(path)
|
|
13
|
+
else:
|
|
14
|
+
size = 0
|
|
15
|
+
for root, _, files in os.walk(path):
|
|
16
|
+
for file in files:
|
|
17
|
+
filepath = os.path.join(root, file)
|
|
18
|
+
try:
|
|
19
|
+
size += os.path.getsize(filepath)
|
|
20
|
+
except OSError:
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
required = size * copies
|
|
24
|
+
free = shutil.disk_usage(path).free
|
|
25
|
+
|
|
26
|
+
return free >= required
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: BUCH
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Check whether there is enough free storage space to create backups of files or directories.
|
|
5
|
+
Author-email: Hossein Pirouz <Hossein.P.2013.1391@gmail.com>
|
|
6
|
+
License-Expression: LGPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/HP2000C/BUCH
|
|
8
|
+
Project-URL: Repository, https://github.com/HP2000C/BUCH
|
|
9
|
+
Project-URL: Issues, https://github.com/HP2000C/BUCH/issues
|
|
10
|
+
Keywords: backup,storage,space,disk,filesystem,check
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
+
Classifier: Topic :: System :: Filesystems
|
|
18
|
+
Classifier: Topic :: Utilities
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# ✅ BUCH Library
|
|
23
|
+
### 🧑🏻💻 A practical library for checking the feasibility of creating backups for a file or folder, as many times as desired...
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
BUCH.py,sha256=yQHYWzA15oYHDjwZml_yt9-kNASRuleTbb3D5jUccXA,626
|
|
2
|
+
buch-1.0.2.dist-info/METADATA,sha256=BeW5LQ6ZaqtBY4IeInU0BHfH5T2RAeQ2x3q9d0Apguw,1075
|
|
3
|
+
buch-1.0.2.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
4
|
+
buch-1.0.2.dist-info/top_level.txt,sha256=0soUsSu6QwHbOpKYhXfbqNpZlnyMv7RStiC-GDnN60M,5
|
|
5
|
+
buch-1.0.2.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
BUCH
|