I have a file (file.txt) containing the absolute path
cat file.txt
#There are white space characters in the file name
/home/user/aws/doc/my doc 1.pdf
/home/user/aws/doc/my doc 2.pdf
IFS=''
for FILE in $(cat "${file.txt}"); do
echo "${FILE}"
/usr/local/bin/aws s3 cp ${FILE} "${S3Path_Bucket}PDF_FOLDER/"
done
exit 0
When I ran the script I am getting an error below
The user-provided path
/home/user/aws/doc/my doc 1.pdf
/home/user/aws/doc/my doc 2.pdf does not exist.
I tried placing the escape character in file.txt
/home/user/aws/doc/my\ doc\ 1.pdf
/home/user/aws/doc/my\ doc\ 1.pdf
I get the same error
The user-provided path
/home/user/aws/doc/my\ doc\ 1.pdf
/home/user/aws/doc/my\ doc\ 2.pdf does not exist.
My file.txt is pretty big and I am trying to figure out how do I copy these files by escaping white space and in a loop.
Thank you!