Off-Topic > Off-Topic - Tiny Core Lounge
Trying to copy a list of files
(1/1)
Juanito:
I'm faced with trying to copy about a 1000 jpg files from 10,000 of other files from a windows hd.
Of course the windows folders have spaces in the folder names, but why will this work:
--- Code: ---sudo cp --parents "/mnt/nfs/backup/DOCUMENTS/dumb windows folder name/dumb file name.jpg" /mnt/public-wd/temp
--- End code ---
and this will not work:
--- Code: ---for F in `cat files`; do sudo cp --parents "$F" /mnt/public-wd/temp; done
--- End code ---
..where files contains a list of the 1000 jpg files enclosed in "", eg "/mnt/nfs/backup/DOCUMENTS/dumb windows folder name/dumb file name.jpg"
..any pointers would be much appreciated
TaoTePuh:
Maybe you are looking for :
--- Code: ---export IFS=
--- End code ---
Lee:
I think it is because
--- Code: ---for F in `cat files` ....
--- End code ---
breaks on spaces as well as on line breaks. Try something like this
--- Code: ---cat files |while read F ; do {
...
} done
--- End code ---
Juanito:
thanks - I got the job done with tar
Navigation
[0] Message Index
Go to full version