Shell Scripts for Cleanup

Shell Scripts for Cleanup

The aim is to be able to input a command and have my computer clean up all miscellaneous files; moving them to their appropriate destination ...

The stretch goal is to automate phone clean-up too ... do I need to root my phone ?!

The best is to put some of these into cron jobs that automatically run ... before shutdown, or on start up perhaps ?!?

  • Set end locations for media files (Docs, PDFs, Audio, Video, etc)
  • Change into appropriate directory
  • Send files to their appropriate location mv
#!/usr/bin/bash

# Prepare our file destinations:
PICS=~/Downloads/Media/PICS
MP3=~/Downloads/Media/MP3
WAV=~/Downloads/Media/WAV
VIDS=~/Downloads/Media/VIDS
PDF=~/Downloads/DOCS/PDFs
CSV=~/Downloads/DOCS/CSV
DOC=~/Downloads/DOCS/DOCX
TXT=~/Downloads/DOCS/TXT
MOBI=~/Downloads/DOCS/MOBI
XLX=~/Downloads/DOCS/XLSX
ZIP=~/Downloads/ZIPS

# Change into our appropriate directory
cd ~/

# Start moving files:
mv *jpg *jpeg *png $PICS
mv *mp3 $MP3
mv *wav $WAV
mv *pdf $PDF
mv *csv $CSV
mv *doc *docx $DOC
mv *txt $TXT

Stretch Goals

  • Write function to handle file movement (file, location)
  • Log behavior
  • Search through folders to find files find