Similar to the question asked here, I'm trying to move a list of files from one folder to another whilst preserving the directory structure. The move command happens after a chain of events earlier in the bash script.
In the linked example, the mv command happens on the fly (in a separate C shell?) while the script is doing its finding. This will not work for me, as I need to process the files in the list through an AV scan first. Once they have passed the AV scan, I then want to move them to their destination, preserving directory structure.
My original solution was
while read moveitems; do
printf "mv \"$moveitems\" \"$hotfolder\"\n"
done <"$filesin" | tee -a "filemoves" >/dev/null
chmod +x $filemoves
$filemoves >> $scanlog
Which only worked as far as moving all files into a single folder, which isn't suitable for this situation.
I'm sure there are many more elegant, efficient solutions to this problem, unfortunately I'm a right-brain person and this kind of thing doesn't come easy to me. Please help! Thanks