thingy_compress.sh 433 B

1234567891011121314151617181920212223242526
  1. #!/bin/sh
  2. sourcefile=${1%/}
  3. if [ ! -d "$sourcefile" ]
  4. then
  5. echo "$1 does not appear to be a directory."
  6. exit 1
  7. fi
  8. timestamp=$(echo $(cat "$sourcefile/timestamp.txt") | sed 's/:/./g')
  9. if [ -z "$timestamp" ]
  10. then
  11. echo "No timestamp?"
  12. exit 1
  13. fi
  14. output="${sourcefile} - ${timestamp}.7z"
  15. if [ -f "${output}" ]
  16. then
  17. echo "Target file ${output} already exists"
  18. exit 1
  19. fi
  20. 7z a -mx=9 "${output}" "${sourcefile}"