Re: copying files from ls command


Subject: Re: copying files from ls command
From: David J. Weller-Fahy (dave-lists-aklug@weller-fahy.com)
Date: Wed Jan 14 2004 - 18:49:40 AKST


* Justin Dieters <enderak@gci.net> [2004-01-14 15:57 -0900]:
> I can get a list of the directories I want using
> "ls -I<dir_to_remove_from_list> -I<dir_to_remove_from_list>..."

Groovy, that's the first I'd heard of the -I option.

> In this particular instance, I want to copy all files in a particular
> directory except the directories named "1999 Files", "2000 Files",
> etc. There are spaces in some of the directory names, so I have to
> either put them in quotes or use escape characters for the spaces.
>
> My current attempt is:
> cp -rfpv `ls --quoting-style=escape -I<...>` /destdir

Maybe (this could be overkill) try this:

#v+
for SOMEthing in `ls -I<...>`
do
        cp -rfpv ${SOMEthing} /destdir/
done
#v-

> How could I get this to work? It's almost like it adds the escape
> character to the \ character, resulting in 'cp' thinking the \ is part
> of the file name and not the escape character for the following space.
> A it doesn't seem add an escape character to the " character,
> resulting in 'cp' thinking that " is part of the file name.

It may take a bit longer, but I'm pretty sure it'll work (it's what I've
used).

Regards,

-- 
dave [ please don't CC me ]
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Wed Jan 14 2004 - 18:49:44 AKST