Skip to content

Commit

Permalink
Add initial cleanup script
Browse files Browse the repository at this point in the history
  • Loading branch information
pathob committed Apr 29, 2021
1 parent 67d0ca1 commit 40ebbdf
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

DIRECTORY=$1
EXTENSION=$2

# delete all files in given directory with given extension with size 0
# could be shorter but this one is easy to read ;-)

find $DIRECTORY -maxdepth 1 -name "*.$EXTENSION" -type f -print0 | while read -d $'\0' file
do
if [ $(stat -c%s "$file") -eq 0 ]
then
rm -f "$file"
fi
done

0 comments on commit 40ebbdf

Please sign in to comment.