Composite patterns in bash for copying

I've used several hours today to try to make a shell (bash) script in order to take backup of some (quite some) directories. The problem (challenge) is that i want to leave some files (the big result files) out.
My directory structure:
Dir/
SubDir1/
   smallfile1
   smallfile2
   bigfile
SubDir2
   smallfile1
   smallfile2
   bigfile
By switching on extglob in bash (shopt -s extglob) it is possible to use socalled composite patterns for wildcards (ref. http://www.linux-mag.com/content/view/1528/43/), and i thought this would help.
Problem 1: I try to type in the following command, standing above Dir/, cp -R Dir/*/!(bigfile) new_location. This does not reproduce the directory structure (which i need) and files from Dir2 overwrites files from Dir1.
Problem 2: Since i didn't know how to solve problem 1, i tried to make a small bash script so that i can be in Dir/ and just write 'mycopy 1' so that 'cp SubDir1/!(bigfile) new_location/SubDir1' is run. Now i get an error message which says that "(" is unexpected.
Now i'm 100% stuck and i really don't want to do it manually...

You need to Control click (or right click)in the selected area below so that you will be able to see the Copy/paste menu:
!http://i37.tinypic.com/ehixl.png!
A

Similar Messages

  • DPL and composite pattern

    Hello...using DPL, JE (3.1.0), and trying to come up with a design that fits the following mold:
    @Entity
    public class Thing {
       @PrimaryKey
       long id;
       @SecondaryKey(relate=MANY_TO_ONE)
       int thingTypeId;
       // how to link this to thing attribute model below?
       List<ThingAttribute> thingAtts = new ArrayList<ThingAttribute>( );
    }Thus, a Thing can have a list of attributes. A thing has a unique id (primary key), and a thing has a thing-type id...and there can be many instances of that thing-type, so it is MANY_TO_ONE.
    Now, a ThingAttribute follows the Composite Pattern...as below. I took a stab at annotations here, but I'm not sure it seems correct:
    @Persistent
    public abstract class AbstractThingAttribute {
       /* only simple attribute subclass has an id -- composite subclass does not
        * so we add a sequence here
       @PrimaryKey(sequence="ID")
       long id;
       // thing type id
       @SecondaryKey(relate=MANY_TO_ONE)
       int thingAttributeType;
    @Entity
    public class SimpleThingAttribute<T> extends AbstractThingAttribute {
      // unique id
      @SecondaryKey(relate=ONE_TO_ONE)
      long id;
      // generic type value
      T value;
    @Entity
    public class CompositeThingAttribute extends AbstractThingAttribute {
      // this is a recursive-definition relationship; not sure how to deal with DPL?
      // list of children
      List<ThingAttribute> children = new ArrayList<ThingAttribute>( );
    }As an aside, there is an interface for ThingAttribute, SimpleThingAttribute, and CompositeThingAttribute...this is not too relevant for this example, but Simple/Composite interfaces extend the ThingAttribute interface.
    Q1) If I create a new Thing object, and I want to persist it, it is clear to me how it works for the primary secondary key here, but how do I annotate the ThingAttribute hierarchy such that it gets persisted along with the Thing object? I guess this boils down to a couple things:
    a) how to treat the thingAtts ArrayList in a Thing object itself so it gets persisted?
    b) now, i have a list of objects, where each entry in the list follows the structure of the composite pattern. how should i approach annotating this model?
    Thanks in advance,
    Davis

    Hi Davis!
    Q1) If I create a new Thing object, and I want to
    persist it, it is clear to me how it works for the
    primary secondary key here, but how do I annotate the
    ThingAttribute hierarchy such that it gets persisted
    along with the Thing object? I guess this boils down
    to a couple things:
    a) how to treat the thingAtts ArrayList
    in a Thing object itself so it gets persisted?You just embed the thingAttrs object (as you have) in the entity. As long as the class is @Persistent (or a simple type) you can persist arbitrarily complex graphs of objects. The thin to remember is that it is stored as one object graph per entity, indexed by primary key and optionally by one or more secondary keys.
    b) now, i have a list of objects, where each entry
    in the list follows the structure of the composite
    pattern. how should i approach annotating this
    model? Don't annotate the embedded objects with @Entity, just with @Persistent. @Entity is only used when you want a separate PrimaryIndex. Objects embedded inside an entity are annotated with @Persistent only.
    So when you have multiple objects you can use either embedding or relationships. With embedding, the object graph for the entire entity is stored in a single record.
    With relationships, you store the keys of one entity as a field in the other entity, and you annotate that field with @SecondaryIndex(relate=..., relatedEntity=...). With relationships, you have to get the related object yourself via its own PrimaryIndex.
    Hope this helps,
    Mark

  • Which mapping pattern would work for this?

    Hi,
    i been trying to create a mapping program.
    the source structure is as
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
      <ns0:Message1>
        <ns:MT_SOURCE xmlns:ns="http://test.bsa.demo">
          <GT_ABC>
            <field1>6</field1>
            <keyfield>1001</keyfield>
            <field2>2</field2>
          </GT_ABC>
          <GT_ABC>
            <field1>6</field1>
            <keyfield>1002</keyfield>
            <field2>2</field2>
          </GT_ABC>
          <GT_XYZ>
            <field1>7</field1>
            <keyfield>1002</keyfield>
            <field2>3</field2>
          </GT_XYZ>
          <GT_XYZ>
            <field1>12</field1>
            <keyfield>1003</keyfield>
            <field2>3</field2>
          </GT_XYZ>
          <GT_XYZ>
            <field1>15</field1>
            <keyfield>1004</keyfield>
            <field2>4</field2>
          </GT_XYZ>
        </ns:MT_SOURCE>
      </ns0:Message1>
    </ns0:Messages>
    and the desired target structure to be generated is based on the total no. of keyfield entries.
    suppose that keyfied entry has values,
    1002 for substructures GT_ABC and GT_XYZ
    1001 for substructures GT_ABC.
    then there should be 2 occurences of target structure for keyfields 1001 and 1002 respectively.
    for the occurence of 1001 the structure MT_KEYFIELD should have substructure GT_ABC
    for the occurence of 1002 the structure MT_KEYFIELD should have substructures GT_ABC and GT_XYZ since both of them have keyfield value as 1002
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
      <ns0:Message1>
        <MT_KEYFIELD> 0..unbounded
          <GT_ABC>   0..unbounded
            </field1>
            </keyfield>
            </field2>
          </GT_ABC>
          <GT_XYZ>   0..unbounded
            </field1>
            </keyfield>
            </field2>
          </GT_XYZ>
        </MT_KEYFIELD>
      </ns0:Message1>
    </ns0:Messages>
    after mapping is executed the target strucuture should be as shown below
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
      <ns0:Message1>
        <MT_KEYFIELD>
          <GT_ABC>
            <field1>6</field1>
            <keyfield>1001</keyfield>
            <field2>2</field2>
          </GT_ABC>
        </MT_KEYFIELD>
        <MT_KEYFIELD>
          <GT_ABC>
            <field1>6</field1>
            <keyfield>1002</keyfield>
            <field2>2</field2>
          </GT_ABC>
          <GT_XYZ>
            <field1>7</field1>
            <keyfield>1002</keyfield>
            <field2>3</field2>
          </GT_XYZ>
        </MT_KEYFIELD>
          <GT_XYZ>
            <field1>12</field1>
            <keyfield>1003</keyfield>
            <field2>3</field2>
          </GT_XYZ>
        </MT_KEYFIELD>
        <MT_KEYFIELD>
          <GT_XYZ>
            <field1>15</field1>
            <keyfield>1004</keyfield>
            <field2>4</field2>
          </GT_XYZ>
        </MT_KEYFIELD>
      </ns0:Message1>
    </ns0:Messages>
    which mapping pattern would helpful for this?????
    Thanks & Regards,
    Bibinu

    I am an independent web designer/developer and have separate
    clients with non-related websites each of which is hosted remotely.
    Would I be able to set up a client as a Contribute user (assuming
    they bought the software) and allow them to edit areas of their
    site?
    Yes, that is possible. Each client would have his own license
    though. You could then administer the sites from your own copy of
    Contribute.
    This may seem like a dumb question, but in going through
    several tutorials it isn't clear to me whether Contribute is
    intended for content editors all of whom work within one
    organization and who all access a web server within their
    organization's IT network to do this editing. I can't quite
    understand how the software on the desktop on my client's computer
    interfaces at all with settings that I set on my own installation.
    Is some server technology needed here?
    The editors don't have to be working in the same organization.
    The connection is made through ftp-like connections from the users
    computer to the server, and the administration of the site is
    maintained at the server and kept up to date at the clients
    computer. I suggest you download the trial version of Contribute
    CS3 to check it out.

  • How can I make the paths visible in a composite pattern created via the Swatch Palette?

    I created a swatch, used it to make a large composite pattern.  I can't find the paths.  They are needed so that
    a laser cutter can follow them for production.  What am I missing?

    Try selecting everything with the pattern and use Expand (or Expand Appearance, which ever is available) from the object menu. You might need to cleanup quite a lot depending on how you constructed the paths in the original pattern tile.

  • Short key for copy does not work all the time now.

    After I have installed the latest OSX - Yosemite, my short key for copy does not work all the time.  It is infrequent how it works. I'm using the same keyboard that I have always used, my wireless logitech keyboard for mac.  Please help.

    I've plugged in my default mac keyboard and the short key copy still does not work.

  • BADI implementation for Copying control in CRM

    HI,
      Can anybody help me for my requirment, i want to implement BADI for copying control in CRM how to implement, and i want to filed in qutation screen how .
    Regards,
    Sivakumar.

    Check the BADI "ME_PROCESS_PO_CUST".
    Regards
    Vinod

  • I need php code for copy paste our all histroy of browser in a text page.

    I need php code for copy paste our all histroy of browser in a text page can any one send me the code please.

    You can use an application like GarageSale for doing this....
    http://www.macupdate.com/info.php/id/16035/garagesale

  • Short cut for copying a cd or dvd data disk?

    Is there a keyboard shortcut for copying a data disk, CD or DVD?
    I know I can create a folder, then copy all the data off a CD or DVD into
    that folder and effectively get the same thing, but I was wondering if
    there was a one keyboard keyboard shortcut.
    When you do right click and copy of a data disk, what you get is just
    an alias to the disk, not a copy.
    Thanks.

    Mount the CD/DVD/disk Image, OPTION-click on the disk icon at the top of the window that opens, and drag to the Desktop or another Finder window. That should create a folder containing everything whatever you mounted.

  • Does anybody know table for copy controls from Sales document to Delivery

    Hi,
    Does anybody know table for copy controls from Sales document to Delivery. Especially for item level.
    Regards,
    Praveen

    >
    Lakshmipathi wrote:
    > Almost all members know copy control from sale order to delivery.  What exactly your problem is ??   Please post that and avoid asking questions like this !!!!!!!!!!
    >
    > thanks
    > G. Lakshmipathi
    Sorry for my post. I guess you were a wee bit quicker than me in the reposnse

  • I've just found the keyboard shortcut in Garageband for 'copy region' had changed from cmdC to ctrlC. I went to Preferences and clicked Restore Defaults for shortcuts. Now its altC . How can I get it back to the original commands.

    I've just found the keyboard shortcut in Garageband for 'copy region' had changed from cmdC to ctrlC. I went to Preferences and clicked Restore Defaults for shortcuts. Now its altC . How can I get it back to the original commands.

    When I use find file http://www.macupdate.com/app/mac/30073/find-file (which does tend to find files that "Finder" can't), it's not coming up with any other itunes library files that have been modified in the past week, which I know it would have been - unfortunately, I don't have a very recent backup of the hard drive.  It would be a few months old so it wouldn't have the complete library on it....any ideas?  I'm wondering if restarting the computer might help but have been afraid to do so in case it would make it harder to recover anything...I was looking at this thread https://discussions.apple.com/thread/4211589?start=0&tstart=0 in the hopes that it might have a helpful suggestion but it's definitely a different scenario.

  • How maintain the Customise setting for copy the text to sales doc to sales

    Hi SAP Gurus,
    How to customise the text for copy to sales documents to sales documents and output.Kindly needful for me.
    Regards
    Vikram.M

    This is determined based on the access sequence specified for the Text ID.
    You can go to IMG/logistics execution/Basic shipping functions/Text control/Define access sequences for determining texts.
    You may also use t-code VOTXN.
    If you are trying to check text being copied to delivery header,then click the radio button for the delivery header and click display. go to the relevant text determination procedure and
    Check the access sequence assigned to the Text id not being copied.
    The Text object should be VBBK to copy texts from sales order header,VBBP for sales item texts.
    You can compare it with your other text ids and their access sequences and make the necessary change to the one that is not being copied.
    Regards,

  • How to make data in a table availabel for copying?

    I'm trying to display a result set in a table, so that they could be copy-pasted to another file (be that a text file, an Excel spreadsheet or anything). The table comes out okay. But, as I try to copy the data, nothing is copied. So, I want to know how to make the data in the table available for copying. Thanks!

    This is exactly what I'm trying to do. The problem is that the data just doesn't get to the clipboard. No matter how hard I try clicking Ctrl-C, it's just not there. When I press Ctrl-V it's not pasted. Why? And how can I correct this problem? Maybe there is some property in JTable class that I have to set as 'true'?

  • SCAT program for copying BOM from one material to another material??

    Hi Gurus,
    Tried creating SCAT program for copying BOM from one material to another material and founf that the copying function does not work.
    Please advise??
    Thank you.
    Naveen.

    HI Satish Ji,
    We are using version 6.0.
    We were able to create SCAT for creating new BOM but, for copying we are facing an issue.
    Kindly advice.
    Thank you.
    Naveen.

  • I need code for copy ,cut and paste

    please help me to find acode for copy,cut and paste .
    from file to another.

    Try playing with this;-
    java.awt.Toolkit.getDefaultToolkit().getSystemClipboard()

  • Looking for copy of snow leopard, hate lion but don't want to pay 100$

    I am looking for copy of snow leopard for a reasonable price. I hate lion it will not run any of my power pc software that I've spent $$ on. But don't want to pay 100$+ for a copy when a few months ago you could get it for 29$ 

    It's still $29, unless you want to pay $100 for some opportunists selling it through Amazon or eBay.
    To upgrade, you must buy Snow Leopard by calling the phone number in the Apple Online Store: 800-MY-APPLE (in the US).
    Snow Leopard is not available for download from any legitimate source.
    Make sure your system meets Snow Leopard's requirements:
    Mac OS X 10.6 "Snow Leopard" System Requirements
    To install Snow Leopard for the first time, you must have a Mac with:
    An Intel processor
    An internal or external DVD drive, or DVD or CD Sharing
    At least 1 GB of memory (RAM) (additional RAM is recommended)
    A built-in display or a display connected to an Apple-supplied video card supported by your computer
    At least 5 GB of disk space available, or 7 GB of disk space if you install the developer tools

Maybe you are looking for

  • How to move iTunes Library to new computer

    I am selling my imac and getting a retina mbp, but the imac will be gone before I can get the new one. So, I need to move all my music from the imac onto an external hard drive to import later. How can I go about doing this? If possible I could just

  • Opening document in frame with javascript

    Hello. I've got problem with javascript on Safari 4 (both and on Win and on MacOS), while trying to open html document in frame. Reproducing the problem is quite difficult, so I'll begin with html source. I have one frame in index.html file: +<iframe

  • DMR. ePubs can't be opened.

    For many years now I've always had the same Adobe ID. I've had different hardware, replacing stuff that became obsolete or that self-destructed. All the items in question were purchased by me from the same vendor (ibs.it). However, it's possible they

  • HTML Preview for Financial Reportings  Books

    Hi all, im creating a book in financial reporting. The problem i have found is that when i open the book in html preview i can't expand members. It seems that financial reporting doesn't let you to expand members of its reports when you are in html p

  • Using Consignment Stock and filling up an unrelated Sales Order

    Hi there, Apologies if this has been covered elsewhere, but I have an issue that I hoped SCN may be able to resolve. We have a client for whom we hold Stock in our warehouse location. We fill up this stock using SAP Sales Orders (at 0 revenue) to mai