Posted By

brownrl on 05/18/13


Bash script cron cleanup

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


Cleanup Downloads Directory

 / Published in: PHP


This is a simple script to go into your downloads directory ( mac ). Move everything to a .YYYY-MM-DD folder. Thus you Downloads directory gets cleaned up and anything that was there has been placed into a hidden folder for finding later.

My Downloads folder is just always full of things but I don't want to blast it empty. Re-getting a file from some website is sometimes hard to remember. So I move everything to a backup and start again.

  1. #!/bin/bash
  3. cd ~
  4. cd Downloads
  5. i=`date +%Y-%m-%d`
  6. mkdir .$i 2> /dev/null
  7. cp -rf * .$i 2> /dev/null
  8. rm -rf * 2> /dev/null

Report this snippet  

You need to login to post a comment.