mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
fix-sd: backup corrupt files to pwd
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -xfu
|
||||
|
||||
drive="$1"
|
||||
mountpoint="/media/sd-card-$(date +%s)"
|
||||
backup_directory="$(pwd)"
|
||||
|
||||
trap clean EXIT
|
||||
clean() {
|
||||
@@ -14,6 +16,6 @@ mkdir "$mountpoint"
|
||||
mount "$drive" "$mountpoint"
|
||||
|
||||
echo "$filenames" | while read -r filename; do
|
||||
find "$mountpoint" -type f -name "$filename" -exec rm {} \;
|
||||
find "$mountpoint" -type f -name "$filename" -exec mv {} "$backup_directory" \;
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user