1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

fix-sd: recheck after cleanup

This commit is contained in:
2024-10-23 07:54:18 +02:00
parent e7a77fbfb5
commit a0b7362fc5

View File

@@ -8,7 +8,8 @@ backup_directory="$(pwd)"
trap clean EXIT
clean() {
umount "$mountpoint"
rm "$mountpoint"
rmdir "$mountpoint"
fsck.exfat "$drive"
}
filenames="$(fsck.exfat "$drive" 2>&1 | sed -nE "s/.* file '(.*?)' is not allocated.*/\1/p")"
@@ -18,4 +19,3 @@ mount "$drive" "$mountpoint"
echo "$filenames" | while read -r filename; do
find "$mountpoint" -type f -name "$filename" -exec mv {} "$backup_directory" \;
done