Sort files into folders by type
One loop moves every file into a folder named after its extension — pdf, jpg, txt — creating the folders as it goes. Upper- and lower-case extensions land together, and nothing is overwritten.
How
Go to the messy folder:
cd ~/Downloads
Move each file into a folder named for its type:
for f in *.*; do [ -f "$f" ] || continue; e=$(echo "${f##*.}" | tr "[:upper:]" "[:lower:]"); mkdir -p "$e" && mv -n "$f" "$e/"; done
Files with no extension stay where they are. If a folder already holds a file with the same name, the new one is left in place rather than replacing it.
Or just ask Titan
Tidy my Downloads folder into folders by file type.Do it with Titan
Titan is an AI that lives on your computer: tell it what you need and it does it while you watch — you press Return, nothing runs by itself. What is Titan?
Titan isn’t on this computer yet. Get Titan, then press the button again — the task will be waiting, typed in.