Remove defase_draws.sh script and improve file renaming logic in tasks.sh for better handling of duplicate files and proper extension assignment.

This commit is contained in:
Danilo Reyes
2026-01-16 15:25:39 -06:00
parent 64676aca5d
commit 155967f8e9
2 changed files with 10 additions and 13 deletions

View File

@@ -1,7 +0,0 @@
#!/etc/profiles/per-user/jawz/bin/bash
cd /home/jawz/Development/Websites/portfolio/content/friends || exit
for file in [0-9][0-9][0-9]_*; do
mv "$file" "$(printf '%03d_%s' $((10#${file%%_*} + 1)) "${file#*_}")"
done

View File

@@ -155,18 +155,22 @@ while IFS= read -r file; do
continue
fi
echo "The file $(basename "$file")" \
"will be renamed, the propper extension is $correct_ext"
"will be renamed, the proper extension is $correct_ext"
new_name="$filename".$correct_ext
if command mv -n "$(dirname "$file")"/{"$(basename "$file")","$new_name"}; then
dest_path="$(dirname "$file")/$new_name"
if [ ! -e "$dest_path" ]; then
mv "$file" "$dest_path"
continue
fi
file_hash="$(sha256sum "$file" | gawk '{ print $1 }')"
if ! echo "$file_hash $(dirname "$file")/$new_name" | sha256sum -c; then
continue
if echo "$file_hash $dest_path" | sha256sum -c --quiet; then
echo "Deleting duplicate (same hash): $file"
rm "$file"
else
echo "WARNING: $file and $dest_path have different content, skipping"
fi
echo "deleting duplicated: $file"
rm "$file"
done < <(fd . "${directories[@]}" -d 1 -tf)
files_home_clean=(.pki HuionCore.pid DriverUI.pid huion.log)