I am trying to get files having size greater than 1k and with an txt extension my code is as follows :
files=$(find foldername -size +1k -name \*.txt -exec {} \;)
for item in $files
do
echo $item
done
But I am getting unexpected output as given below. Please help !!!
DEST/sample - Copy - Copy.txt: line 1: Hello: command not found
DEST/sample - Copy - Copy.txt: line 2: This: command not found
DEST/sample - Copy - Copy.txt: line 3: In: command not found
DEST/sample - Copy - Copy.txt: line 4: $'\r': command not found
DEST/sample - Copy - Copy.txt: line 5: User: command not found
DEST/sample - Copy - Copy.txt: line 6: -s: command not found
DEST/sample - Copy - Copy.txt: line 7: -d: command not found
DEST/sample - Copy - Copy.txt: line 8: -t: command not found
DEST/sample - Copy - Copy.txt: line 9: $'\r': command not found
DEST/sample - Copy - Copy.txt: line 10: $'\r': command not found
DEST/sample - Copy - Copy.txt: line 11: Hello: command not found
DEST/sample - Copy - Copy.txt: line 12: This: command not found
DEST/sample - Copy - Copy.txt: line 13: In: command not found
DEST/sample - Copy - Copy.txt: line 14: $'\r': command not found
DEST/sample - Copy - Copy.txt: line 15: User: command not found
DEST/sample - Copy - Copy.txt: line 16: -s: command not found
DEST/sample - Copy - Copy.txt: line 17: -d: command not found
DEST/sample - Copy - Copy.txt: line 18: -t: command not found
DEST/sample - Copy - Copy.txt: line 19: $'\r': command not found
DEST/sample - Copy - Copy.txt: line 20: Hello: command not found
DEST/sample - Copy - Copy.txt: line 21: This: command not found
DEST/sample - Copy - Copy.txt: line 22: In: command not found
DEST/sample - Copy - Copy.txt: line 23: $'\r': command not found
DEST/sample - Copy - Copy.txt: line 24: User: command not found
DEST/sample - Copy - Copy.txt: line 25: -s: command not found
DEST/sample - Copy - Copy.txt: line 26: -d: command not found
DEST/sample - Copy - Copy.txt: line 27: -t: command not found
DEST/sample - Copy.txt: line 1: Hello: command not found
DEST/sample - Copy.txt: line 2: This: command not found
DEST/sample - Copy.txt: line 3: In: command not found
DEST/sample - Copy.txt: line 4: $'\r': command not found
DEST/sample - Copy.txt: line 5: User: command not found
DEST/sample - Copy.txt: line 6: -s: command not found
DEST/sample - Copy.txt: line 7: -d: command not found
DEST/sample - Copy.txt: line 8: -t: command not found
DEST/sample - Copy.txt: line 9: $'\r': command not found
DEST/sample - Copy.txt: line 10: $'\r': command not found
DEST/sample - Copy.txt: line 11: Hello: command not found
DEST/sample - Copy.txt: line 12: This: command not found
DEST/sample - Copy.txt: line 13: In: command not found
DEST/sample - Copy.txt: line 14: $'\r': command not found
DEST/sample - Copy.txt: line 15: User: command not found
DEST/sample - Copy.txt: line 16: -s: command not found
DEST/sample - Copy.txt: line 17: -d: command not found
DEST/sample - Copy.txt: line 18: -t: command not found
DEST/sample - Copy.txt: line 19: $'\r': command not found
DEST/sample - Copy.txt: line 20: Hello: command not found
DEST/sample - Copy.txt: line 21: This: command not found
DEST/sample - Copy.txt: line 22: In: command not found
DEST/sample - Copy.txt: line 23: $'\r': command not found
DEST/sample - Copy.txt: line 24: User: command not found
DEST/sample - Copy.txt: line 25: -s: command not found
DEST/sample - Copy.txt: line 26: -d: command not found
DEST/sample - Copy.txt: line 27: -t: command not found