Professional Web Applications Themes

Exclude one file from copy folder - Linux / Unix Administration

Hello I have a problem i want to copy saome folder /test/web/local to other folder I copy them using something like that cp -p -r /test/web/local /home/local/test and evrything is ok without one thing. When I copy that folder I have error cp: /test/web/local/apache/logs/cgisock: Operation not supported on socket I want to exclude only thath file during copy. How I can do that. Please help me....

  1. #1

    Default Exclude one file from copy folder

    Hello

    I have a problem i want to copy saome folder /test/web/local to other
    folder I copy them using something like that


    cp -p -r /test/web/local /home/local/test


    and evrything is ok without one thing.


    When I copy that folder I have error
    cp: /test/web/local/apache/logs/cgisock: Operation not supported on
    socket


    I want to exclude only thath file during copy. How I can do that.


    Please help me.

    seboizm Guest

  2. #2

    Default Re: Exclude one file from copy folder

    On 20 Mar 2006 06:52:39 -0800 "seboizm" <pl> wrote: 

    how about

    (cd /test/web/local; find . -depth ) | cpio -pdm /home/local/test

    which will copy the socket. If you're using GNU tar you can do the
    'tar cf - | tar xf -' trick and pass some --exclude option.

    -frank
    Frank Guest

  3. #3

    Default Re: Exclude one file from copy folder

    seboizm wrote: 

    You have just noticed that "cp -r" is the wrong tool for the job,
    and rather than asking what the right tool is, you headed in
    the wrong direction.

    Use the right tool for the job and you do not need to exclude it.

    Since a tar example has already been given and there are more
    than one right tool (cp is not one of the right tools), I'll offer a
    version using cpio.

    cd /test/web/local ; find . -depth -print | cpio -oc | ( cd
    /home/local/test ; cpio -itvc)

    Extra points for modifying to use only one cpio and no subshell. ;^)

    The reason I offered a cpio option is it can be modified by adding
    "| grep -v cgisock" to exclude that file or because the "-type" switch
    in find can be used in assorted ways to exclude that file. Using
    the right tool like tar or cpio there's no need to do so, but it can be
    done. (Note: most versions of tar allow exclude lists so you should
    be able to exclude it unnessecarily with tar as well).

    Doug Guest

Similar Threads

  1. Question how to exclude a folder from Authentication?
    By Engineermazzion in forum Brainstorming Area
    Replies: 0
    Last Post: March 28th, 07:12 AM
  2. Extension to copy files to local folder
    By ndutzie in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 1
    Last Post: August 8th, 12:45 PM
  3. Can I allow access to one file within a folder, but notthe whole folder
    By arnspiger in forum Macromedia Contribute Connection Administrtion
    Replies: 0
    Last Post: April 6th, 10:39 PM
  4. Copy & rename entire folder structure
    By skooter in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: February 17th, 05:12 PM
  5. howto use c# regular expression validator to exclude file types
    By Brian Vallelunga in forum ASP.NET General
    Replies: 2
    Last Post: July 31st, 10:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139