SHARE
TWEET

createlist

tolikpunkoff May 6th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3.  
  4. FOUNDLST=""
  5.  
  6. DIR1="/home/smallwolfie/test/archives"
  7. DIR2="/home/smallwolfie/test/isos"
  8.  
  9. TARGZ=""
  10. ISO=""
  11.  
  12. create_list() #$1 - dir, $2 - file mask
  13. {
  14.     FOUNDLST=""
  15.     for FLE in $(find $1 -maxdepth 1 -iname $2); do
  16.     if [ -n "$FLE" ]; then
  17.         FOUNDLST="$FOUNDLST"`basename $FLE`"\n"
  18.     fi
  19.     done
  20. }
  21.  
  22. create_list $DIR1 "*.tar.gz"
  23.  
  24. if [ -z "$FOUNDLST" ]; then
  25.     echo "$DIR1 *.tar.gz not found"
  26. else
  27.     TARGZ=$FOUNDLST
  28. fi
  29.  
  30. create_list $DIR2 "*.iso"
  31.  
  32. if [ -z "$FOUNDLST" ]; then
  33.     echo "$DIR2 *.iso not found"
  34. else
  35.     ISO=$FOUNDLST
  36. fi
  37.  
  38. create_list $DIR2 "*.zip"
  39.  
  40. if [ -z "$FOUNDLST" ]; then
  41.     echo "$DIR2 *.zip not found"
  42. fi
  43.  
  44. echo "*.tar.gz:"
  45. echo -e -n "$TARGZ"
  46. echo "-----------"
  47. echo "*.iso:"
  48. echo -e -n "$ISO"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top