banderas20
Active Member
Hi.
I have the following script which searches for a list of files (included in a list.txt file) and then copies them into a new directory. The source files are all under the same folder, but they are scattered among several subfolders.
However, it always gets stuck in the first file. It's like the find command gave timeout.
I have made sure that the files do exist.
Am I missing something?
Thanks in advance!
PS: Using RedHat
I have the following script which searches for a list of files (included in a list.txt file) and then copies them into a new directory. The source files are all under the same folder, but they are scattered among several subfolders.
Code:
#!/bin/bash
SOURCE="/opt/source_folder/"
DEST="/home/destfolder"
while read -r line
do
find $SOURCE -type f -name "$line" -exec cp {} $DEST \;
done < list.txt
I have made sure that the files do exist.
Am I missing something?
Thanks in advance!
PS: Using RedHat
Last edited: