Guest User

Untitled

a guest
Aug 21st, 2021
27
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #!/usr/bin/env bash
  3.  
  4. for dir in * ; do
  5.         for json_file in $dir/*.json ; do
  6.                 rating=$(cat $json_file | jq '.rating' | tr -d '"')
  7.                 img_filename=$(basename $(cat $json_file | jq '.file_url' | tr -d '"'))
  8.                 img_path=$dir/$img_filename
  9.  
  10.                 echo $img_path $rating
  11.  
  12.                 if [ "$rating" = "s" ]; then
  13.                         echo $img_path is safe
  14.                 else
  15.                         rm -v $img_path
  16.                         rm -v $json_file
  17.                 fi
  18.         done
  19. done
  20.  
RAW Paste Data