This script is to find a list of files stored in a text file, and if the files are found, copy them to a specific location. So far I have had success running the portions up to but not including the portion that actually copies the files. When I add the code to copy the file, starting with exec, the script no longer appears to work and makes no progress. I would like to understand what is locking this script up and how to make it work correctly. Thanks!
#!/bin/bash
#Find files from a list in a file and copy them to a common folder
mapfile -t filelist < filelist.txt
for file in "${filelist[@]}"; do
xargs find ~ -name '${filelist[@]}' -exec mv -t ~/Document/foundfiles/ {} +;
done
Asked by user289380
May 8, 2018, 12:43 AM
Last activity: Mar 17, 2025, 07:24 AM
Last activity: Mar 17, 2025, 07:24 AM