WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Trying to copy a list of files  (Read 2429 times)

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14535
Trying to copy a list of files
« on: February 04, 2011, 05: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

Offline TaoTePuh

  • Full Member
  • ***
  • Posts: 172
Re: Trying to copy a list of files
« Reply #1 on: February 04, 2011, 06:25:08 AM »
Maybe you are looking for :

Code: [Select]
export IFS=

Offline Lee

  • Hero Member
  • *****
  • Posts: 645
    • My Core wiki user page
Re: Trying to copy a list of files
« Reply #2 on: February 04, 2011, 06: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

32 bit core4.7.7, Xprogs, Xorg-7.6, wbar, jwm  |  - Testing -
PPR, data persistence through filetool.sh          |  32 bit core 8.0 alpha 1
USB Flash drive, one partition, ext2, grub4dos  | Otherwise similar

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14535
Re: Trying to copy a list of files
« Reply #3 on: February 04, 2011, 07:31:51 AM »
thanks - I got the job done with tar