diff --git a/TODO.txt b/TODO.txt index c9afa69..f9ac5b8 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,4 +1,12 @@ +- Fix copy/mv through symlink - Handle filenames and destinations with spaces in them -- Make serial number processing consistent across BSD and Linux - Make serial number postfix consistent across dirs and files -- Option to disable serial numbers + +Doc Notes +--------- + +- Test mode has no effect on -d which always works +- If -d is effective immediately upon reading command line so + you can clean multiple graveyards with: + + /trm.sh -g ./foo -d -g ./baz -d diff --git a/trm.sh b/trm.sh index 6bf3320..df26f76 100755 --- a/trm.sh +++ b/trm.sh @@ -18,8 +18,10 @@ # Parse command line args OPERATOR="mv" # Can be overriden with -c option - OPTLIST='cdg:tvx' # List of all legal command line options + OPTLIST='cdg:stvx' # List of all legal command line options OPTIND=1 # getopts may have been previously used in this context + + SERIALNO="Yes" # Generate serial numbers TESTMODE="" VERBOSE="" @@ -43,6 +45,11 @@ GRAVEYARD=${OPTARG} ;; + # Turn of serial number generation + s) + SERIALNO="" + ;; + # Don't do anything, just show what you would do t) TESTMODE=${TESTING} @@ -81,10 +88,16 @@ REALPATH=$(readlink -f $arg) fi + # See if we want serial numbers + SERIAL="" + if [ -n "${SERIALNO}" ] + then + SERIAL=".$(date +%Y%m%d%H%M%S)" + fi + SRCDIR=$(dirname $REALPATH) SRCFIL=$(basename $REALPATH) DESDIR=${GRAVEYARD}${SRCDIR} - SERIAL=".$(date +%Y%m%d%s%N)" DESFIL="${SRCFIL}${SERIAL}" CMD="${OPERATOR} $VERBOSE '${REALPATH}' '${DESDIR}/${DESFIL}'"