Skip to content

Commit

Permalink
add the garbage-in, with some tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
phunehehe committed May 6, 2012
1 parent a2c0589 commit f857098
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions garbage-in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

ar_dir="~/.archive"

for arg in "$@"
do
# Move this thing to the archive
thing="$(readlink -f "$arg")"
dest_dir="$ar_dir$(dirname "$thing")"
destination="$dest_dir/$(basename "$thing").$(date +'%Y-%m-%d_%H-%M-%S')"
mkdir -p "$dest_dir"
mv "$thing" "$destination"
find "$destination" -type f -exec touch {} \;
done

# TODO: Clean up old and useless files and dirs

0 comments on commit f857098

Please sign in to comment.