Advertisement
IvoB1n

Untitled

Nov 16th, 2020
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. search() {
  2. for name in "$1"/*; do
  3. if [ $filter_flag -eq 1 ] && printf "$name" | grep -qE "^.*\/(.*$filter\w{0,})$"; then
  4. : # if filter was enabled, ignore dirs and files
  5. else
  6. # if file was found, save it's size to array
  7. if [ -f "$name" ]; then
  8. file_count=$(($file_count + 1))
  9. write_f_size "$name"
  10.  
  11. # if dir was found, call search function (recursivly)
  12. elif [ -d "$name" ]; then
  13. dir_count=$(($dir_count + 1))
  14. search "$name";
  15. fi
  16. fi
  17. done
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement