b-drop 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/mksh
  2. DRSR=$HOME/1drop/
  3. IMGS=/mnt/toshstor/i/t/drop
  4. SRTD=$HOME/1sort
  5. f_wrap()
  6. {
  7. [ ! -d "$3" ] && mkdir -p "$3"
  8. if [ $1 -eq 0 ]
  9. then
  10. find $DRSR -regextype posix-egrep -regex "$2" -exec mv -n -t "$3" {} +
  11. else
  12. find $DRSR -name "$2" -exec mv -n -t "$3" {} +
  13. fi
  14. return 0
  15. }
  16. # pictures
  17. f_wrap 0 ".*\.(svg|tga|psd|bmp|gifv|webp)$" "$IMGS/random"
  18. f_wrap 0 ".*\.(jpg|jpeg|jpe)$" "$IMGS/random/jpg"
  19. f_wrap 1 "*.gif" "$IMGS/random/gif"
  20. f_wrap 1 "*.png" "$IMGS/random/png"
  21. # arch
  22. f_wrap 0 ".*\.(tar|zip|7z|rar|gz|xz|bz2|tgz)$" "$SRTD/archive"
  23. # applications
  24. f_wrap 0 ".*\.(deb|run|bin|rpm|sh|py)$" "$SRTD/run/linux"
  25. f_wrap 0 ".*\.(diff|patch)$" "$SRTD/run/linux/patches"
  26. f_wrap 0 ".*\.(exe|msi)$" "$SRTD/run/win"
  27. f_wrap 1 "*.apk" "$SRTD/run/android"
  28. f_wrap 1 "*.jar" "$SRTD/run/java"
  29. # texts
  30. f_wrap 0 ".*\.(pdf|djvu|txt|doc|docx|fb2|epub|rtf|mobi|ps)$" "$SRTD/text"
  31. f_wrap 0 ".*\.(html|htm|mht|mhtml|chm|maff)$" "$SRTD/pages"
  32. f_wrap 0 ".*\.(c|cpp|ebuild|js|h)$" "$SRTD/sources"
  33. # media
  34. f_wrap 0 ".*\.(flv|mp4|avi|mkv|mov|webm|wmv)$" "$SRTD/videos"
  35. f_wrap 0 ".*\.(mp3|ogg|flac|sid|xm|wma|wav)$" "$SRTD/sound"
  36. f_wrap 1 "*.swf" "$SRTD/swf"
  37. # mics
  38. f_wrap 1 "*.torrent" "$SRTD/tor"
  39. f_wrap 1 "*.iso" "$SRTD/iso"
  40. f_wrap 1 "*.xpi" "$SRTD/addons"
  41. f_wrap 0 ".*\.(sqlite|csv|db)$" "$SRTD/db"
  42. f_wrap 0 ".*\.(ttf|otf|woff|pcf|bdf)$" "$SRTD/fonts"
  43. exit 0