Move all the text files in a directory into subdirectories by name
#!/usr/bin/env python3
from pathlib import Path
import shutil
for f in Path(".").glob("*.txt"):
if f.name[0] in "abcdefghijklmnopqrstuvwxyz":
d = Path(f.name[0])
if d.is_dir():
shutil.move(str(f), str(d / f.name))
