copying files from ls command


Subject: copying files from ls command
From: Justin Dieters (enderak@gci.net)
Date: Wed Jan 14 2004 - 15:57:17 AKST


I have been struggling with this for the past hour - hopefully someone can help me out. I am trying to copy an entire directory, except for a few selected directories within that directory.

I can get a list of the directories I want using "ls -I<dir_to_remove_from_list> -I<dir_to_remove_from_list>..."

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

But this results in errors like Cannot stat file 'Blah\\'

If I try --quoting-style=c or --quoting-style=shell, I get similar errors, Cannot stat file '"Blah'

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.

Any ideas?

Thanks,
Justin

---------
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 - 15:57:21 AKST