Tiny Core Linux

Off-Topic => Off-Topic - Tiny Core Lounge => Topic started by: Juanito on February 04, 2011, 08:35:27 AM

Title: Trying to copy a list of files
Post by: Juanito on February 04, 2011, 08:35:27 AM
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: [Select]
sudo cp --parents "/mnt/nfs/backup/DOCUMENTS/dumb windows folder name/dumb file name.jpg" /mnt/public-wd/temp
and this will not work:
Code: [Select]
for F in `cat files`; do sudo cp --parents "$F" /mnt/public-wd/temp; done
..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
Title: Re: Trying to copy a list of files
Post by: TaoTePuh on February 04, 2011, 09:25:08 AM
Maybe you are looking for :

Code: [Select]
export IFS=
Title: Re: Trying to copy a list of files
Post by: Lee on February 04, 2011, 09:25:52 AM
I think it is because
Code: [Select]
for F in `cat files` ....
breaks on spaces as well as on line breaks.  Try something like this

Code: [Select]
cat files |while read F ; do {
...
} done

Title: Re: Trying to copy a list of files
Post by: Juanito on February 04, 2011, 10:31:51 AM
thanks - I got the job done with tar