This is the solution for looping:
for ((i=0 ; i<${#arr[@]} ; i++ ))
do
//...compare here
done
make sure to keep the spaces when initializing 'i' and comparing it..
Вопрос
I managed to separate hash from file path while finding duplicates in my directory. My next task is to print only the duplicates (ex: 3 files, 2 duplicates).
What I did so far is placing the output in an array like this:
arr=( $(find $1 -type f -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate) )
I need to count the number of duplicates of each file(not original), get the size of each and list their paths respectively.
I tried to do a for loop in my arr, but I can't compare hashes, it gives me the value too great for base
error.
Any tips would be great.
SOLVED
for ((i = 0 ; i < ${#arr[@]} ; i++ ))
do
//...compare here
done
Решение
This is the solution for looping:
for ((i=0 ; i<${#arr[@]} ; i++ ))
do
//...compare here
done
make sure to keep the spaces when initializing 'i' and comparing it..