#!/usr/bin/env bash # Path to the list of files FILELIST="filelist.txt" # Destination directory DESTINATION="." # Copy each file listed in FILELIST to DESTINATION # The 'while read -r' loop ensures we handle spaces in filenames properly while read -r FILEPATH; do # If the line in the filelist isn't empty, copy the file if [ -n "$FILEPATH" ]; then echo "Copying: $FILEPATH -> $DESTINATION" cp "$FILEPATH" "$DESTINATION" fi done < "$FILELIST"