Posted By

brownrl on 05/18/13


Tagged

Bash script cron cleanup


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Priestd09


Cleanup Downloads Directory


 / Published in: PHP
 

URL: http://www.itsgotto.be/cv.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
  2.  
  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.