2
0

clean-package.sh 416 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. [ -n "$1" -a -n "$2" ] || {
  3. echo "Usage: $0 <file> <directory>"
  4. exit 1
  5. }
  6. [ -f "$1" -a -d "$2" ] || {
  7. echo "File/directory not found"
  8. exit 1
  9. }
  10. cat "$1" | (
  11. cd "$2"
  12. while read entry; do
  13. [ -n "$entry" ] || break
  14. [ -f "$entry" ] && rm -f $entry
  15. done
  16. )
  17. cat "$1" | (
  18. cd "$2"
  19. while read entry; do
  20. [ -n "$entry" ] || break
  21. [ -d "$entry" ] && rmdir "$entry" > /dev/null 2>&1
  22. done
  23. )
  24. true