I want to not copy exclude one file when i Copy

I want to not copy exclude one file when i Copy

Post by seboiz » Tue, 28 Mar 2006 21:19:39



I wnat to exclude not copy one file from folder. I copy all folder
/usr/local and in that folder is subfolder /usr/local/web/logs/ when is
file cgisock which i don't want to copy because he give me error.
Itrying something like that

cp -p -r /usr/local /test >/home/fi/raport 2>&1 | grep "cgisock"

but all files copyig with cgisock wich give me error what can I do with
that file never coping how I can exclude for cp please help me???

--
seboizm

 
 
 

I want to not copy exclude one file when i Copy

Post by cgw_.. » Tue, 28 Mar 2006 23:28:09


either move it out of there, then move it back when you've finished the
copy, change it to a hidden file, then change it back again, write a
for loop to exclude the filename etc etc etc

 
 
 

I want to not copy exclude one file when i Copy

Post by Hajo Ehler » Wed, 29 Mar 2006 01:12:25



> either move it out of there, then move it back when you've finished the

...

This might not be a good idea because the file might be in use or being
a pipe or what so ever.

Depending on the type of file the OP could just ignore the error
message or - like you mentioned - use a filelist .

regards
Hajo

 
 
 

I want to not copy exclude one file when i Copy

Post by seboiz » Wed, 29 Mar 2006 05:27:23


I know that i can ignore that file but my script which copy that folder
sending me mail with error information - and I want to repair thet then
I have good diagnostic information and i don't copy only that one file
which i specified in my post "cgisock" - you have right this file that
is socket. How can I copy that folder and don't copy only that one file
"cgisock". I can't ignore them i must to have realy information about
copying that folders and files. I ask you "cp: command give me result
which I want? Please of our help beacause i dont't know what can i do
in that situation??

--
seboizm

 
 
 

I want to not copy exclude one file when i Copy

Post by Robert Bono » Wed, 29 Mar 2006 09:01:27




>I know that i can ignore that file but my script which copy that folder
>sending me mail with error information - and I want to repair thet then
>I have good diagnostic information and i don't copy only that one file
>which i specified in my post "cgisock" - you have right this file that
>is socket. How can I copy that folder and don't copy only that one file
>"cgisock". I can't ignore them i must to have realy information about
>copying that folders and files. I ask you "cp: command give me result
>which I want? Please of our help beacause i dont't know what can i do
>in that situation??

the cp command does *NOT* have an option to let you specify filenames
that are not to be copied.

You have several choices:
   1) build a list of all the names that you _do_ want copied, and
      tell  cp to copy _those_ files
   2) use some _other_ command to do the copying -- one which _does_
      support 'excluding' named files.
   3) use a loop in your script that:
         a) iterates for _every_ named file in the directory
         b) checks to see if the current name is 'cgisock' and if so,
            merely skips to the next name to be checked.
         c) if the file is not named 'cgisock' ,then the file is copied
            to the destination.

Lastly, you can just use 'cp', as is, and 'edit out' the error message
about 'cgisock' _before_ the email is sent. Something like:

             cp {{from}} {{to}} | 2>1 grep -v "cgisock"

 
 
 

I want to not copy exclude one file when i Copy

Post by seboiz » Wed, 29 Mar 2006 15:16:12


Ok I have problem because i begin to lern shell scripting if you have
give some advice little script which dont send me that erro to copy i
use something like that script:
#!/bin/sh
cp -p -r /usr/local /test >/home/local/logi/cp_warn 2>&1
if [ "$?" = "0" ]
 then
   echo "Copy OK">>/home/local/logfb
 else
   echo "Bad copy">>/home/local/logfb_baz
   mailx -s "Bad copy" root </home/local/logi/cp_warn  
fi
 
 
 

1. copy all files in a dir to another renaming them as they are copied

sounds simple to me but:

all I can guess is the renaming part. but I get lost on how to pipe
everything together.

Here's my renaming criteria:

cut -d 't' -f6;sed -e 's/01_5E//g' | cut -c12-50

does this make sense??

I figured a for each in dir thing might do it
but ...

thanks ahead of time

dmc

2. some modules for Apache 1.1.1

3. ksh: Copying files one by one

4. Digital Camera Possible ?

5. copying data from one file into some other file with VI

6. Newbie.... CDRW... HP product!

7. How can I copy Multipal files(10000) in to one single .txt file

8. Re-Re-PARTITIONNING

9. Copy file structure but not files?

10. Copy, Embrace, Exclude

11. "lp" does not print more than one copy

12. Broadcast Sockets, copy one file to n machines???

13. (1 on 1 copy for CD) CD copy of PSX-CD's