Skip to content

Instantly share code, notes, and snippets.

@romansavrulin
Created February 23, 2023 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romansavrulin/4cc5f86621a95ecedd3675456079fd0e to your computer and use it in GitHub Desktop.
Save romansavrulin/4cc5f86621a95ecedd3675456079fd0e to your computer and use it in GitHub Desktop.
Remove files by md5 sum list
#!/bin/bash
cut -f 2- -d ' ' md5.sum > file.list
input="file.list"
######################################
# $IFS removed to allow the trimming #.
#####################################
while read -r line
do
file=$(echo $line | awk 'sub(/ *$/, "", $0)')
[ -f "$file" ] && rm "$file"
done < "$input"
rm "$input"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment