How can I process the results of find in a bash script?

前端 未结 5 735
闹比i
闹比i 2020-12-07 15:54

I\'m trying to use an array to store a list of file names using the find command.

For some reason the array fails to work in the bash used by the school

5条回答
  •  天命终不由人
    2020-12-07 16:01

    find . -name '*.txt' | while IFS= read -r FILE; do
        echo "Copying $FILE.."
        cp "$FILE" /destination
    done
    

提交回复
热议问题