n Tuesday 23 May 2006 09:17 am, Duncan Anderson wrote:
  
 No problem. I like the mosquito/sledgehammer analogy. Tell me, do you know
how to overcome the problem of file names being rejected by find when they
contain spaces, etc.?
    

No never had any of those probs, I think. What exactly do you mean?
All files including the ones with spaces show up.

I mostly use find in combination with cpio to copy/move contents from one 
(usually almost full) partition to another. Never lost a file.

Just yesterday I copied a 7G partition's content (my old 32_bit / partition I 
still keep in reserve) from a dying HD to a new one. Compared 'em and didn't 
loose a single thing. Still boots up fine after editing its "/etc/fstab".

the whole (lovely unixy) command is "find . | cpio -padm /mnt/new_partition" 
whilst being in the topmopst directory of the to be copied partition, BTW.
  
I'll second that - just tried find on a set of files with spaces in their names and it finds
them with no problems. If you want to pipe these through to other programs, you can
use the -print0 (that's print and a zero) option which ends each file with a null rather
than a newline (see man find). Then you can use xargs -0 to read them in. So you could
do something like
find . -iname "*.*" -print0 | xargs -0 grep -i "searchitem"
to find searchitem within a set of files with spaces. (The -i's mean case insensitive)

Neill

Reply via email to