Restory-files 0.0.1__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.
- Restory_files/__init__.py +0 -0
- Restory_files/__main__.py +125 -0
- Restory_files/estimate_recovery_rate.py +9 -0
- Restory_files/recovery.py +15 -0
- Restory_files/scanner.py +25 -0
- restory_files-0.0.1.dist-info/METADATA +65 -0
- restory_files-0.0.1.dist-info/RECORD +11 -0
- restory_files-0.0.1.dist-info/WHEEL +5 -0
- restory_files-0.0.1.dist-info/entry_points.txt +2 -0
- restory_files-0.0.1.dist-info/licenses/LICENSE +19 -0
- restory_files-0.0.1.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
|
|
2
|
+
import argparse
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
from Restory_files.scanner import scan_folder
|
|
6
|
+
from Restory_files.recovery import recover_file
|
|
7
|
+
from Restory_files.estimate_recovery_rate import estimate_recovery
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Scan Command
|
|
11
|
+
def scan_command(path="."):
|
|
12
|
+
path = os.path.abspath(path)
|
|
13
|
+
|
|
14
|
+
print(f"\n[+] Scanning: {path}")
|
|
15
|
+
|
|
16
|
+
result = scan_folder(path)
|
|
17
|
+
|
|
18
|
+
print("\n[+] Scan Results:")
|
|
19
|
+
print(result)
|
|
20
|
+
|
|
21
|
+
return result
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# Recover Command
|
|
25
|
+
def recover_command(source, destination):
|
|
26
|
+
print(f"\n[+] Recovering: {source}")
|
|
27
|
+
|
|
28
|
+
result = recover_file(source, destination)
|
|
29
|
+
|
|
30
|
+
print("\n[+] Recovery Results:")
|
|
31
|
+
print(result)
|
|
32
|
+
|
|
33
|
+
return result
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# Estimate Command
|
|
37
|
+
def estimate_command(file):
|
|
38
|
+
print(f"\n[+] Estimating: {file}")
|
|
39
|
+
|
|
40
|
+
result = estimate_recovery(file)
|
|
41
|
+
|
|
42
|
+
print(f"\n[+] Recovery Rate: {result}%")
|
|
43
|
+
|
|
44
|
+
return result
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# Version Command
|
|
48
|
+
def version_command():
|
|
49
|
+
version = "0.0.1"
|
|
50
|
+
|
|
51
|
+
print(f"FileRecovery v{version}")
|
|
52
|
+
|
|
53
|
+
return version
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# Main Function
|
|
57
|
+
def main():
|
|
58
|
+
|
|
59
|
+
parser = argparse.ArgumentParser(
|
|
60
|
+
prog="filerestory",
|
|
61
|
+
description="File Recovery"
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
subparsers = parser.add_subparsers(
|
|
65
|
+
dest="command"
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# Scan
|
|
69
|
+
scan_parser = subparsers.add_parser(
|
|
70
|
+
"scan",
|
|
71
|
+
help="Scan files"
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
scan_parser.add_argument(
|
|
75
|
+
"path",
|
|
76
|
+
nargs="?",
|
|
77
|
+
default="."
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# Recover
|
|
81
|
+
recover_parser = subparsers.add_parser(
|
|
82
|
+
"recover",
|
|
83
|
+
help="Recover files"
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
recover_parser.add_argument("source")
|
|
87
|
+
recover_parser.add_argument("destination")
|
|
88
|
+
|
|
89
|
+
# Estimate
|
|
90
|
+
estimate_parser = subparsers.add_parser(
|
|
91
|
+
"estimate",
|
|
92
|
+
help="Estimate recovery rate"
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
estimate_parser.add_argument("file")
|
|
96
|
+
|
|
97
|
+
# Version
|
|
98
|
+
subparsers.add_parser(
|
|
99
|
+
"version",
|
|
100
|
+
help="Show version"
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
args = parser.parse_args()
|
|
104
|
+
|
|
105
|
+
if args.command == "scan":
|
|
106
|
+
scan_command(args.path)
|
|
107
|
+
|
|
108
|
+
elif args.command == "recover":
|
|
109
|
+
recover_command(
|
|
110
|
+
args.source,
|
|
111
|
+
args.destination
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
elif args.command == "estimate":
|
|
115
|
+
estimate_command(args.file)
|
|
116
|
+
|
|
117
|
+
elif args.command == "version":
|
|
118
|
+
version_command()
|
|
119
|
+
|
|
120
|
+
else:
|
|
121
|
+
parser.print_help()
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
if __name__ == "__main__":
|
|
125
|
+
main()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import shutil
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
def recover_file(path, dest_folder="RECOVERED_LIB"):
|
|
5
|
+
try:
|
|
6
|
+
os.makedirs(dest_folder, exist_ok=True)
|
|
7
|
+
|
|
8
|
+
name = os.path.basename(path)
|
|
9
|
+
dest = os.path.join(dest_folder, name)
|
|
10
|
+
|
|
11
|
+
shutil.copy2(path, dest)
|
|
12
|
+
|
|
13
|
+
return True, dest
|
|
14
|
+
except Exception as e:
|
|
15
|
+
return False, str(e)
|
Restory_files/scanner.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pprint import pformat
|
|
3
|
+
|
|
4
|
+
def scan_folder(path):
|
|
5
|
+
results = []
|
|
6
|
+
|
|
7
|
+
for root, dirs, files in os.walk(path):
|
|
8
|
+
for f in files:
|
|
9
|
+
full = os.path.join(root, f)
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
size = os.path.getsize(full)
|
|
13
|
+
ext = os.path.splitext(f)[1].lower()
|
|
14
|
+
|
|
15
|
+
results.append({
|
|
16
|
+
"path": full,
|
|
17
|
+
"name": f,
|
|
18
|
+
"size": size,
|
|
19
|
+
"ext": ext
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
except:
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
return pformat(results)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Restory_files
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A package to restore files from the computer recycle bin
|
|
5
|
+
Author-email: mohamadreza <anmm65357@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- Scan files and directories
|
|
19
|
+
- Process multiple files
|
|
20
|
+
- Estimate recovery rate
|
|
21
|
+
- Simple terminal commands
|
|
22
|
+
- Easy to use
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# Install the package:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install Restory_files
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
### 1. Help
|
|
34
|
+
|
|
35
|
+
Display all available commands:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
Restory_files --help
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Scan
|
|
42
|
+
Scan the current directory:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
Restory_files scan .
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Scan a specific directory:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
Restory_files scan ./files
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. Recover
|
|
55
|
+
|
|
56
|
+
Specify a source and destination:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
Restory_files recover path "LIB"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 4.estimate_recovery_rate
|
|
63
|
+
```bash
|
|
64
|
+
Restory_files estimate 800
|
|
65
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Restory_files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
Restory_files/__main__.py,sha256=SqfNPRv4aoxWbD-99u0HyUoSipvABhSJNnnj16aABOc,2379
|
|
3
|
+
Restory_files/estimate_recovery_rate.py,sha256=Tc0GY0OzbAwUPVGABR9a1j6CmflAtLAtAoXwmudtjMc,204
|
|
4
|
+
Restory_files/recovery.py,sha256=emVwY5bRfldqephLARHoVBok_SPOVscNbDx3CEdhoio,351
|
|
5
|
+
Restory_files/scanner.py,sha256=2VltDbWexucG_tIIKm66d6jNpnDWbkFjnqEc02JhUdw,581
|
|
6
|
+
restory_files-0.0.1.dist-info/licenses/LICENSE,sha256=qjfKOtbbMmif1tk6GB4pt4B6cqaNVYkuDnoJJdkR_QE,1072
|
|
7
|
+
restory_files-0.0.1.dist-info/METADATA,sha256=hwUAsYK6AnL9n1cHv6avKZDEY34iKLv3d7ELv9j3Vn8,1062
|
|
8
|
+
restory_files-0.0.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
9
|
+
restory_files-0.0.1.dist-info/entry_points.txt,sha256=Nqo5TWrwEweN1y2ktmxLeZfsBjnLNwe0UKr-LScTUQQ,62
|
|
10
|
+
restory_files-0.0.1.dist-info/top_level.txt,sha256=gCd1zASmd_8uWZjIt3Gdxrk52FFzEeaz1c_zIEgdz1s,14
|
|
11
|
+
restory_files-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2026 Mohamadreza
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Restory_files
|