How to copy with files with spaces with cp command

112 Views Asked by At

I am copying files with spaces with the help of small script for f in "$file"; do echo "$f"; cp $f ~/Documents/; done. echo command works well and returns full name of files

DailyTransactionLedger.xls
12722 FinRep.xlsx
RP - Jul 2022.pdf

But copy command gives mess.

cp: cannot stat '12722': No such file or directory
cp: cannot stat 'FinRep.xlsx': No such file or directory
cp: cannot stat 'RP': No such file or directory
cp: cannot stat '-': No such file or directory
cp: cannot stat 'Jul': No such file or directory
cp: cannot stat '2022.pdf': No such file or directory

Do somebody has any insights?

0

There are 0 best solutions below