eolas/_scripts/clean_image_directory.sh

11 lines
353 B
Bash
Raw Normal View History

2022-12-27 18:30:05 +00:00
#!/bin/bash
# If there are images in _img/ that are not being used in the workspace, delete them
find /home/thomas/repos/computer_science/_img -type f | while read filename; do
2022-12-27 18:30:05 +00:00
rg "${filename##*/}" ../ --type markdown >/dev/null 2>&1
if [ "$?" -eq 1 ]; then
echo "Deleted unused image: ${filename##*/}"
rm $filename
fi
done