Skip to content

Instantly share code, notes, and snippets.

@eduardogpg
Last active November 23, 2022 00:34
Show Gist options
  • Select an option

  • Save eduardogpg/85e44fc453c1e1068769c63b57c52c4a to your computer and use it in GitHub Desktop.

Select an option

Save eduardogpg/85e44fc453c1e1068769c63b57c52c4a to your computer and use it in GitHub Desktop.
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