filesysman 1.0.0__tar.gz
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.
- filesysman-1.0.0/LICENSE +1 -0
- filesysman-1.0.0/PKG-INFO +167 -0
- filesysman-1.0.0/README.md +156 -0
- filesysman-1.0.0/filesysman/__init__.py +20 -0
- filesysman-1.0.0/filesysman/filesysman.py +1006 -0
- filesysman-1.0.0/filesysman.egg-info/PKG-INFO +167 -0
- filesysman-1.0.0/filesysman.egg-info/SOURCES.txt +13 -0
- filesysman-1.0.0/filesysman.egg-info/dependency_links.txt +1 -0
- filesysman-1.0.0/filesysman.egg-info/top_level.txt +1 -0
- filesysman-1.0.0/pyproject.toml +19 -0
- filesysman-1.0.0/setup.cfg +4 -0
- filesysman-1.0.0/tests/test_edge_cases.py +628 -0
- filesysman-1.0.0/tests/test_file.py +134 -0
- filesysman-1.0.0/tests/test_folder.py +161 -0
- filesysman-1.0.0/tests/test_functions.py +497 -0
filesysman-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
MIT License
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: filesysman
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Utilities for managing files and folders in Python.
|
|
5
|
+
Author: Saif Bayoumy
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
|
|
12
|
+
# filesysman
|
|
13
|
+
|
|
14
|
+
A simple Python library for creating, managing, searching, copying, moving, and organizing files and folders.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- Create and delete files and folders
|
|
19
|
+
- Read, write, and append file content
|
|
20
|
+
- Rename files and folders
|
|
21
|
+
- Copy and move files and folders
|
|
22
|
+
- Search for files by keyword
|
|
23
|
+
- Search recursively through subfolders
|
|
24
|
+
- Find files by extension
|
|
25
|
+
- Organize files by extension
|
|
26
|
+
- Get information about files and folders
|
|
27
|
+
- Count files
|
|
28
|
+
- Find and remove empty folders
|
|
29
|
+
- Work with multiple files at once
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Install the package using pip:
|
|
34
|
+
|
|
35
|
+
pip install filesysman
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
### Working with Files
|
|
40
|
+
|
|
41
|
+
from filesysman import File
|
|
42
|
+
|
|
43
|
+
file = File("example.txt")
|
|
44
|
+
|
|
45
|
+
file.create()
|
|
46
|
+
file.write("Hello, World!")
|
|
47
|
+
|
|
48
|
+
print(file.read())
|
|
49
|
+
print(file.name)
|
|
50
|
+
print(file.suffix)
|
|
51
|
+
print(file.size)
|
|
52
|
+
|
|
53
|
+
### Working with Folders
|
|
54
|
+
|
|
55
|
+
from filesysman import Folder
|
|
56
|
+
|
|
57
|
+
folder = Folder("my_folder")
|
|
58
|
+
|
|
59
|
+
folder.create()
|
|
60
|
+
|
|
61
|
+
print(folder.exists())
|
|
62
|
+
print(folder.name)
|
|
63
|
+
print(folder.path)
|
|
64
|
+
|
|
65
|
+
### Working with Multiple Files
|
|
66
|
+
|
|
67
|
+
from filesysman import create_files, get_files
|
|
68
|
+
|
|
69
|
+
create_files(
|
|
70
|
+
"file1.txt",
|
|
71
|
+
"file2.txt",
|
|
72
|
+
"file3.txt"
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
files = get_files()
|
|
76
|
+
|
|
77
|
+
for file in files:
|
|
78
|
+
print(file)
|
|
79
|
+
|
|
80
|
+
## Searching for Files
|
|
81
|
+
|
|
82
|
+
Search for files containing a specific keyword in their names:
|
|
83
|
+
|
|
84
|
+
from filesysman import find_files
|
|
85
|
+
|
|
86
|
+
files = find_files("report")
|
|
87
|
+
|
|
88
|
+
for file in files:
|
|
89
|
+
print(file)
|
|
90
|
+
|
|
91
|
+
You can also search recursively through subfolders:
|
|
92
|
+
|
|
93
|
+
from filesysman import find_files_recursive
|
|
94
|
+
|
|
95
|
+
files = find_files_recursive("report")
|
|
96
|
+
|
|
97
|
+
for file in files:
|
|
98
|
+
print(file)
|
|
99
|
+
|
|
100
|
+
## Organizing Files by Extension
|
|
101
|
+
|
|
102
|
+
Files can be organized into folders based on their extensions:
|
|
103
|
+
|
|
104
|
+
from filesysman import organize_by_extension
|
|
105
|
+
|
|
106
|
+
organize_by_extension()
|
|
107
|
+
|
|
108
|
+
For example:
|
|
109
|
+
|
|
110
|
+
Before:
|
|
111
|
+
|
|
112
|
+
folder/
|
|
113
|
+
├── photo.jpg
|
|
114
|
+
├── document.pdf
|
|
115
|
+
├── script.py
|
|
116
|
+
└── notes.txt
|
|
117
|
+
|
|
118
|
+
After:
|
|
119
|
+
|
|
120
|
+
folder/
|
|
121
|
+
├── JPG/
|
|
122
|
+
│ └── photo.jpg
|
|
123
|
+
├── PDF/
|
|
124
|
+
│ └── document.pdf
|
|
125
|
+
├── PY/
|
|
126
|
+
│ └── script.py
|
|
127
|
+
└── TXT/
|
|
128
|
+
└── notes.txt
|
|
129
|
+
|
|
130
|
+
## Main API
|
|
131
|
+
|
|
132
|
+
### Classes
|
|
133
|
+
|
|
134
|
+
- File
|
|
135
|
+
- Folder
|
|
136
|
+
|
|
137
|
+
### File and Folder Operations
|
|
138
|
+
|
|
139
|
+
- create_files()
|
|
140
|
+
- delete_files()
|
|
141
|
+
- rename_files()
|
|
142
|
+
- copy_files()
|
|
143
|
+
- move_files()
|
|
144
|
+
|
|
145
|
+
### Searching and Retrieving
|
|
146
|
+
|
|
147
|
+
- get_files()
|
|
148
|
+
- find_files()
|
|
149
|
+
- get_files_count()
|
|
150
|
+
- get_files_recursive()
|
|
151
|
+
- find_files_recursive()
|
|
152
|
+
- get_folders()
|
|
153
|
+
|
|
154
|
+
### Organization and Cleanup
|
|
155
|
+
|
|
156
|
+
- organize_by_extension()
|
|
157
|
+
- rename_by_keyword()
|
|
158
|
+
- delete_by_keyword()
|
|
159
|
+
- clear_empty_folders()
|
|
160
|
+
|
|
161
|
+
## Requirements
|
|
162
|
+
|
|
163
|
+
- Python 3.8 or newer
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# filesysman
|
|
2
|
+
|
|
3
|
+
A simple Python library for creating, managing, searching, copying, moving, and organizing files and folders.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Create and delete files and folders
|
|
8
|
+
- Read, write, and append file content
|
|
9
|
+
- Rename files and folders
|
|
10
|
+
- Copy and move files and folders
|
|
11
|
+
- Search for files by keyword
|
|
12
|
+
- Search recursively through subfolders
|
|
13
|
+
- Find files by extension
|
|
14
|
+
- Organize files by extension
|
|
15
|
+
- Get information about files and folders
|
|
16
|
+
- Count files
|
|
17
|
+
- Find and remove empty folders
|
|
18
|
+
- Work with multiple files at once
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
Install the package using pip:
|
|
23
|
+
|
|
24
|
+
pip install filesysman
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
### Working with Files
|
|
29
|
+
|
|
30
|
+
from filesysman import File
|
|
31
|
+
|
|
32
|
+
file = File("example.txt")
|
|
33
|
+
|
|
34
|
+
file.create()
|
|
35
|
+
file.write("Hello, World!")
|
|
36
|
+
|
|
37
|
+
print(file.read())
|
|
38
|
+
print(file.name)
|
|
39
|
+
print(file.suffix)
|
|
40
|
+
print(file.size)
|
|
41
|
+
|
|
42
|
+
### Working with Folders
|
|
43
|
+
|
|
44
|
+
from filesysman import Folder
|
|
45
|
+
|
|
46
|
+
folder = Folder("my_folder")
|
|
47
|
+
|
|
48
|
+
folder.create()
|
|
49
|
+
|
|
50
|
+
print(folder.exists())
|
|
51
|
+
print(folder.name)
|
|
52
|
+
print(folder.path)
|
|
53
|
+
|
|
54
|
+
### Working with Multiple Files
|
|
55
|
+
|
|
56
|
+
from filesysman import create_files, get_files
|
|
57
|
+
|
|
58
|
+
create_files(
|
|
59
|
+
"file1.txt",
|
|
60
|
+
"file2.txt",
|
|
61
|
+
"file3.txt"
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
files = get_files()
|
|
65
|
+
|
|
66
|
+
for file in files:
|
|
67
|
+
print(file)
|
|
68
|
+
|
|
69
|
+
## Searching for Files
|
|
70
|
+
|
|
71
|
+
Search for files containing a specific keyword in their names:
|
|
72
|
+
|
|
73
|
+
from filesysman import find_files
|
|
74
|
+
|
|
75
|
+
files = find_files("report")
|
|
76
|
+
|
|
77
|
+
for file in files:
|
|
78
|
+
print(file)
|
|
79
|
+
|
|
80
|
+
You can also search recursively through subfolders:
|
|
81
|
+
|
|
82
|
+
from filesysman import find_files_recursive
|
|
83
|
+
|
|
84
|
+
files = find_files_recursive("report")
|
|
85
|
+
|
|
86
|
+
for file in files:
|
|
87
|
+
print(file)
|
|
88
|
+
|
|
89
|
+
## Organizing Files by Extension
|
|
90
|
+
|
|
91
|
+
Files can be organized into folders based on their extensions:
|
|
92
|
+
|
|
93
|
+
from filesysman import organize_by_extension
|
|
94
|
+
|
|
95
|
+
organize_by_extension()
|
|
96
|
+
|
|
97
|
+
For example:
|
|
98
|
+
|
|
99
|
+
Before:
|
|
100
|
+
|
|
101
|
+
folder/
|
|
102
|
+
├── photo.jpg
|
|
103
|
+
├── document.pdf
|
|
104
|
+
├── script.py
|
|
105
|
+
└── notes.txt
|
|
106
|
+
|
|
107
|
+
After:
|
|
108
|
+
|
|
109
|
+
folder/
|
|
110
|
+
├── JPG/
|
|
111
|
+
│ └── photo.jpg
|
|
112
|
+
├── PDF/
|
|
113
|
+
│ └── document.pdf
|
|
114
|
+
├── PY/
|
|
115
|
+
│ └── script.py
|
|
116
|
+
└── TXT/
|
|
117
|
+
└── notes.txt
|
|
118
|
+
|
|
119
|
+
## Main API
|
|
120
|
+
|
|
121
|
+
### Classes
|
|
122
|
+
|
|
123
|
+
- File
|
|
124
|
+
- Folder
|
|
125
|
+
|
|
126
|
+
### File and Folder Operations
|
|
127
|
+
|
|
128
|
+
- create_files()
|
|
129
|
+
- delete_files()
|
|
130
|
+
- rename_files()
|
|
131
|
+
- copy_files()
|
|
132
|
+
- move_files()
|
|
133
|
+
|
|
134
|
+
### Searching and Retrieving
|
|
135
|
+
|
|
136
|
+
- get_files()
|
|
137
|
+
- find_files()
|
|
138
|
+
- get_files_count()
|
|
139
|
+
- get_files_recursive()
|
|
140
|
+
- find_files_recursive()
|
|
141
|
+
- get_folders()
|
|
142
|
+
|
|
143
|
+
### Organization and Cleanup
|
|
144
|
+
|
|
145
|
+
- organize_by_extension()
|
|
146
|
+
- rename_by_keyword()
|
|
147
|
+
- delete_by_keyword()
|
|
148
|
+
- clear_empty_folders()
|
|
149
|
+
|
|
150
|
+
## Requirements
|
|
151
|
+
|
|
152
|
+
- Python 3.8 or newer
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from .filesysman import (
|
|
2
|
+
File,
|
|
3
|
+
Folder,
|
|
4
|
+
create_files,
|
|
5
|
+
delete_files,
|
|
6
|
+
rename_files,
|
|
7
|
+
get_files,
|
|
8
|
+
find_files,
|
|
9
|
+
rename_by_keyword,
|
|
10
|
+
delete_by_keyword,
|
|
11
|
+
get_files_count,
|
|
12
|
+
copy_files,
|
|
13
|
+
move_files,
|
|
14
|
+
organize_by_extension,
|
|
15
|
+
get_files_recursive,
|
|
16
|
+
find_files_recursive,
|
|
17
|
+
get_folders,
|
|
18
|
+
clear_empty_files,
|
|
19
|
+
clear_empty_folders,
|
|
20
|
+
)
|