dircmp.fig 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #### dircmp
  2. #### license: creative commons cc0 1.0 (public domain)
  3. #### http://creativecommons.org/publicdomain/zero/1.0/
  4. #### usage: dircmp file1-or-folder file2-or-folder
  5. #### compare two folders (or files containing lists)
  6. #### list only files unique to each folder
  7. # $ ls d1
  8. # apple banana d1 orange
  9. # $ ls d2
  10. # apple orange pear
  11. # $ dircmp d1 d2
  12. # d1 only:
  13. # ./d1
  14. # ./banana
  15. # d2 only:
  16. # ./pear
  17. # $ cd d2 ; find > ../d2.txt ; cd ..
  18. # $ dircmp d1 d2.txt
  19. # d1 only:
  20. # ./d1
  21. # ./banana
  22. # d2.txt only:
  23. # ./pear
  24. try
  25. f1 command mid 1 1
  26. f2 command mid 2 1
  27. o "if [ -f '" plus f1 plus "' ] ; then cat " plus f1 plus " ; else cd " plus f1 plus " ; find ; fi" arrshell
  28. p "if [ -f '" plus f2 plus "' ] ; then cat " plus f2 plus " ; else cd " plus f2 plus " ; find ; fi" arrshell
  29. except
  30. z "dircmp: usage: dircmp file1-or-folder file2-or-folder" print end
  31. resume
  32. xc
  33. yc
  34. z f1 prints " only: " print
  35. forin y o
  36. yin instr p y sgn
  37. ifequal yin 0
  38. z y print
  39. fig
  40. next
  41. z "" print
  42. z f2 prints " only: " print
  43. forin x p
  44. xin instr o x sgn
  45. ifequal xin 0
  46. z x print
  47. fig
  48. next