Been a while since I've been on here. So I have a poorly labeled file collection. A friend wanted to see what I had so i
Code:
:~/ ls ~/files/ > badfiles.txt
They reviewed and edited the file names and sent it back as goodfiles.txt. Now both files correspond line by line but there are no patterns to the editing.
Code:
badfiles.txt goodfiles.txt
FILE NAME1.XXX file name 1
file_name 2.YYY file name 2
file.name3.XXX file name 3
filename(4).ZZZ file name 4
So I ideally want to rename the files but using badfiles.txt as input and goodfiles.txt as output.
I tried this with unintended results
Code:
while read -r a b; do ! [[ -e "$b" ]] && mv "$a" "$b"; done <<< "$(paste badfiles.txt goodfiles.txt)"
and
Code:
paste badfiles.txt goodfiles.txt | while read n k; do mv -T $n* $k; done
and several variations of the above. The goodfiles.txt has been stripped of extensions as well so is it possible to preserve them during the renaming?