]> git.rmz.io Git - dotfiles.git/blobdiff - bin/old/rmold
merge bin from shada
[dotfiles.git] / bin / old / rmold
diff --git a/bin/old/rmold b/bin/old/rmold
new file mode 100755 (executable)
index 0000000..a4c6644
--- /dev/null
@@ -0,0 +1,22 @@
+#! /bin/bash
+
+##
+# This script will remove all files/folders older than 2 weeks in the ~/Downloads
+# folder.
+##
+
+rm /Users/ramsi/Downloads/*.torrent
+
+find $HOME/Downloads -atime +28 -depth 1 -print | while read FILE; do
+
+       # Adds support for files with spaces.
+       cmd="mv \"$FILE\" $HOME/.Trash";
+
+       # Parses the line twice to remove the external quotes.
+       eval $cmd;
+
+       
+       echo "`date \"+%Y-%m-%d\"` removed $FILE" >> /var/log/rmold.log;
+       
+done;
+return 0;