Skip to content

Commit dcaca8c

Browse files
Refactor file organization logic and enhance .gitignore; remove GUI component
1 parent 81aa081 commit dcaca8c

5 files changed

Lines changed: 218 additions & 132 deletions

File tree

.gitignore

Lines changed: 160 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,161 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
8+
# Distribution / packaging
9+
.Python
10+
build/
11+
develop-eggs/
12+
dist/
13+
downloads/
14+
eggs/
15+
.eggs/
16+
lib/
17+
lib64/
18+
parts/
19+
sdist/
20+
var/
21+
wheels/
22+
share/python-wheels/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
MANIFEST
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.nox/
42+
.coverage
43+
.coverage.*
44+
.cache
45+
nosetests.xml
46+
coverage.xml
47+
*.cover
48+
*.py,cover
49+
.hypothesis/
50+
.pytest_cache/
51+
cover/
52+
53+
# Translations
54+
*.mo
55+
*.pot
56+
57+
# Django stuff:
58+
*.log
59+
local_settings.py
60+
db.sqlite3
61+
db.sqlite3-journal
62+
63+
# Flask stuff:
64+
instance/
65+
.webassets-cache
66+
67+
# Scrapy stuff:
68+
.scrapy
69+
70+
# Sphinx documentation
71+
docs/_build/
72+
73+
# PyBuilder
74+
.pybuilder/
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
# For a library or package, you might want to ignore these files since the code is
86+
# intended to run in multiple environments; otherwise, check them in:
87+
# .python-version
88+
89+
# pipenv
90+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
91+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
92+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
93+
# install all needed dependencies.
94+
#Pipfile.lock
95+
96+
# poetry
97+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
98+
# This is especially recommended for binary packages to ensure reproducibility, and is more
99+
# commonly ignored for libraries.
100+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
101+
#poetry.lock
102+
103+
# pdm
104+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
105+
#pdm.lock
106+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
107+
# in version control.
108+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
109+
.pdm.toml
110+
.pdm-python
111+
.pdm-build/
112+
113+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
114+
__pypackages__/
115+
116+
# Celery stuff
117+
celerybeat-schedule
118+
celerybeat.pid
119+
120+
# SageMath parsed files
121+
*.sage.py
122+
123+
# Environments
124+
.env
125+
.venv
1126
env/
2-
.vscode/
3-
.env
127+
venv/
128+
ENV/
129+
env.bak/
130+
venv.bak/
131+
132+
# Spyder project settings
133+
.spyderproject
134+
.spyproject
135+
136+
# Rope project settings
137+
.ropeproject
138+
139+
# mkdocs documentation
140+
/site
141+
142+
# mypy
143+
.mypy_cache/
144+
.dmypy.json
145+
dmypy.json
146+
147+
# Pyre type checker
148+
.pyre/
149+
150+
# pytype static type analyzer
151+
.pytype/
152+
153+
# Cython debug symbols
154+
cython_debug/
155+
156+
# PyCharm
157+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
158+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
159+
# and can be added to the global gitignore or merged into this file. For a more nuclear
160+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
161+
#.idea/

docs/changelog.rst

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,46 @@
11
Changelog
22
=========
33

4-
v1.0.7 (2025-05-22)
5-
-------------------
4+
1.0.7
5+
-----
66

77
- First `Production` release
88
- Organize files via `movens -p <path>`
99
- Version flag `-v` added
10+
11+
12+
1.0.6 - 2022-11-18
13+
-----
14+
15+
- Bug fixed
16+
- Code refactoring
17+
18+
1.0.5 - 2022-11-02
19+
------------------
20+
21+
- PYPI package is now available
22+
- Only create required directories
23+
- Package can be updated from GitHub Action workflow
24+
25+
1.0.4 - 2022-07-04
26+
------------------
27+
28+
- Code refactoring
29+
- Bug fixes
30+
31+
1.0.3 - 2020-09-23
32+
------------------
33+
34+
- Bug fixed
35+
36+
1.0.2 - 2020-09-22
37+
------------------
38+
39+
- New extension added
40+
- Bug fixed
41+
42+
Initial Release - 2020-05-13
43+
----------------------------
44+
45+
- Initial release
46+

movens/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from movens.main import start
1+
from movens.main import organize_files_in_directory
22

3-
__all__ = ['start']
3+
__all__ = ['organize_files_in_directory']

movens/gui/filemovergui.py

Lines changed: 0 additions & 122 deletions
This file was deleted.

movens/main.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,36 @@ def classify_extension(extension: str) -> str:
7777
def organize_files_in_directory(folder_path: str) -> None:
7878
"""
7979
Organize files in the given folder into subfolders based on their extensions.
80-
80+
8181
Args:
8282
folder_path (str): Path of the folder to organize.
8383
"""
84-
folder = Path(folder_path)
84+
folder = Path(folder_path).resolve()
8585
if not folder.exists():
8686
print(f"[!] Provided path does not exist: {folder_path}")
8787
return
8888

89+
current_dir_name = folder.name.lower()
8990
files_to_move = {}
9091

9192
for item in folder.iterdir():
9293
if item.is_file() and not item.name.startswith('.') and '.' in item.name:
9394
if item.name == Path(__file__).name:
9495
continue # Avoid moving the script itself
9596
extension = item.suffix[1:] # Remove the dot
96-
destination_folder = classify_extension(extension)
97-
files_to_move.setdefault(destination_folder, []).append(item)
97+
category_path = classify_extension(extension)
98+
parts = category_path.split('/')
99+
top_level = parts[0].lower()
100+
101+
# Determine actual destination path
102+
if top_level == current_dir_name:
103+
# Remove the top-level category from path
104+
destination_folder = '/'.join(parts[1:]) if len(parts) > 1 else ''
105+
else:
106+
destination_folder = category_path
107+
108+
if destination_folder: # Only move if there's a subfolder
109+
files_to_move.setdefault(destination_folder, []).append(item)
98110

99111
for category in files_to_move:
100112
full_folder_path = folder / category
@@ -107,6 +119,7 @@ def organize_files_in_directory(folder_path: str) -> None:
107119
print(f"[✖] Could not move {file.name}: {e}")
108120

109121

122+
110123
if __name__ == '__main__':
111124
import sys
112125
if len(sys.argv) > 1:

0 commit comments

Comments
 (0)