Last active
November 23, 2022 00:34
-
-
Save eduardogpg/85e44fc453c1e1068769c63b57c52c4a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import shutil | |
| from pathlib import Path | |
| current_path = Path.cwd() | |
| documents_path = current_path / 'documents' | |
| files_path = documents_path / 'txts' | |
| pdfs_path = documents_path / 'pdfs' | |
| images_path = documents_path / 'images' | |
| if not files_path.exists(): | |
| files_path.mkdir() | |
| if not pdfs_path.exists(): | |
| pdfs_path.mkdir() | |
| if not images_path.exists(): | |
| images_path.mkdir() | |
| for dir in documents_path.iterdir(): | |
| if dir.is_file(): | |
| if dir.suffix == '.txt': | |
| shutil.move(str(dir), str(files_path)) | |
| if dir.suffix == '.png' or dir.suffix == '.jpg': | |
| pass | |
| if dir.suffix == '.pdf': | |
| pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment