Automation Scripts

To make my Downloads folder (which is usually a mess; I bet yours as well) clutter-free, I created some folders for some filetypes (like exe, gz, deb) and use DropIt, a file automation tool, to move every downloaded files with those filetypes to their own folders. In the end, I would have three folders, each only containing one filetype.

Sometimes, I also downloaded albums from Bandcamp and Jamendo in zip format, and I’m usually too lazy to extract them. But using DropIt, I could extract the albums and delete the .zips afterwards.

Unfortunately, DropIt is not available for Linux yet, although there are tools that, when used together, would do the same thing (create rules for files, check a folder every x minute/hour/day for files that meet the rules, and apply said rules).

I have managed to create a script that would organize my Downloads folder like I said in the beginning. I don’t know much about bash to begin with, so maybe this script doesn’t look good, but hey, it works:

cd /media/'New Volume_'/Downloads
mv *.exe /media/'New Volume_'/Downloads/exe
mv *.gz /media/'New Volume_'/Downloads/tarballs
mv *.deb /media/'New Volume_'/Downloads/debs

I also created a script for my Bandcamp/Jamendo albums:

cd /media/'New Volume_'/Music/
file-roller -h *.zip
gvfs-trash *.zip

I used file-roller (Ubuntu’s default archiving program) instead of unzip since file-roller would collect all files in an archive into one folder and allows wildcards for filenames. To delete the archives, I used gvfs-trash instead of rm because it would only move files to the trash instead of permanently deleting them.

To run these scripts every hour, I use Gnome Schedule, the GUI to cron.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.