diff --git a/defase_draws.sh b/defase_draws.sh deleted file mode 100755 index 59b8b4e..0000000 --- a/defase_draws.sh +++ /dev/null @@ -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 diff --git a/src/scripts/tasks.sh b/src/scripts/tasks.sh index 3a75751..df3382c 100644 --- a/src/scripts/tasks.sh +++ b/src/scripts/tasks.sh @@ -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)