We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ead7766 commit f124461Copy full SHA for f124461
1 file changed
trashable
@@ -0,0 +1,25 @@
1
+#!/bin/sh
2
+set -euf
3
+
4
+cd ~/.trashable || exit 1
5
6
+# Delete known file names
7
+find . -type f \( -name .DS_Store -o -name desktop.ini -o -name Picasa.ini -o -name Thumbs.db \) -delete
8
9
+# Delete empty items, before the main loop
10
+find . -depth -empty -delete
11
12
+# Find files > 100 bytes, that are not dot files
13
+find . -type f -size +100c \( ! -iname ".*" \) -print0 |
14
+while read -r -d $'\0' x; do
15
+ name=$(basename "$x")
16
+ size=$(file-size "$x")
17
+ sha=$(shasum -a 512 "$x" | awk '{print $1}')
18
+ printf "%s\n" "$sha" >> ~/.trashable.txt
19
+done
20
21
+# Delete the files
22
+find . -type f -size +100c \( ! -iname ".*" \) -delete
23
24
+# Delete empty items, after the main loop
25
0 commit comments