find and move files based on file name pattern

Discussion in 'Programming/Scripts' started by d.custer91, Nov 4, 2014.

  1. d.custer91

    d.custer91 New Member

    i would like to sort two different file name patterns into two differnet folders.

    the two file name patterns are:

    name contains: s00 or e00 or s00e00 or s0e000 or 0x00 - where 0 = digits [0-9]

    and

    name contains a valid 4 digit year
    name does not contain: s00 or e00 or s00e00 or s0e000 or 0x00 - where 0 = digits [0-9]

    if someone can at least push me in the right direction, i'd really appreciate it
     
    Last edited: Nov 4, 2014
  2. d.custer91

    d.custer91 New Member

    Found my answer over at SuperUser

    Here is a script for recognizing and separating movies & tv shows. Just make sure to edit /path/to/tv-shows/ directory at the end of the first line, and also /path/to/movies/ directory at the end of the second line.

    Code:
    find "$TR_TORRENT_DIR/$TR_TORRENT_NAME" -type f -a -not -size -100M -a -not -size +2G -a -not -iname "*sample*" -a -iname "*s[0-9]*" -o -type f -a -not -size -100M -a -not -size +2G -a -not -iname "*sample*" -a -iname "*e[0-9]*" -o -type f -a -not -size -100M -a -not -size +2G -a -not -iname "*sample*" -a -iname "*s[0-9]e[0-9]*" -o -type f -a -not -size -100M -a -not -size +2G -a -not -iname "*sample*" -a -iname "*s[0-9]e[0-9][0-9][0-9]*" -o -type f -a -not -size -100M -a -not -size +2G -a -not -iname "*sample*" -a -iname "*[0-9]x[0-9][0-9]*" -exec cp {} /path/to/tv-shows/ \;
    Code:
    find "$TR_TORRENT_DIR/$TR_TORRENT_NAME" -type f -a -size +500M -a -not -iname "*sample*" -a -not -iname "*s[0-9]*" -a -iname "*19[0-9][0-9]*" -o -type f -a -size +500M -a -not -iname "*sample*" -a -not -iname "*e[0-9]*" -a -iname "*19[0-9][0-9]*" -o -type f -a -size +500M -a -not -iname "*sample*" -a -not -iname "*s[0-9]e[0-9]*" -a -iname "*19[0-9][0-9]*" -o -type f -a -size +500M -a -not -iname "*sample*" -a -not -iname "*s[0-9]e[0-9][0-9][0-9]*" -a -iname "*19[0-9][0-9]*" -o -type f -a -size +500M -a -not -iname "*sample*" -a -not -iname "*[0-9]x[0-9][0-9]*" -a -iname "*19[0-9][0-9]*" -o -type f -a -size +500M -a -not -iname "*sample*" -a -not -iname "*s[0-9]*" -a -iname "*20[0-9][0-9]*" -o -type f -a -size +500M -a -not -iname "*sample*" -a -not -iname "*e[0-9]*" -a -iname "*20[0-9][0-9]*" -o -type f -a -size +500M -a -not -iname "*sample*" -a -not -iname "*s[0-9]e[0-9]*" -a -iname "*20[0-9][0-9]*" -o -type f -a -size +500M -a -not -iname "*sample*" -a -not -iname "*s[0-9]e[0-9][0-9][0-9]*" -a -iname "*20[0-9][0-9]*" -o -type f -a -size +500M -a -not -iname "*sample*" -a -not -iname "*[0-9]x[0-9][0-9]*" -a -iname "*20[0-9][0-9]*" -exec cp {} /path/to/movies/ \;
    Then you can add this to the bottom of the script which removes and deletes torrents that have finished seeding. You will need to replace username and password in both spots.

    Code:
    transmission-remote --auth=username:password -l | grep Finished | \
    awk '{print $1}' | xargs -n 1 -I % transmission-remote --auth=username:password -t % --remove-and-delete
     
  3. AlbertMi

    AlbertMi Banned

    does Being Overweight Cause Fibroids

    <p>But who knows how these mechanics works compared to the main DCU vs. In her origin story she slept with her professors for better grades, got an internship at Arkham Asylum because she thought she could skyrocket quickly up the corporate ladder by writing a book about the crazies, and got suckered in by Joker. I love it otherwise.
    miu miu cat eye sunglasses And if you read up a bit about him you will find that he even suspended paint filled cans above a board, punched holes in the bottom of the can, and allowed the cans to swing, or be nudged, the paint slowly dripping to give a totally no representative image. The important thing to remember here is that he had no intention of producing any kind likeness to anything physical whatsoever. So this style of art is truly an abstract work.</p>.
    miu miu suede boots <p>There are varied types of ways to apply hair extensions. Out of them, depending on your current hair style, you may opt for any one of the hair extension methods. If you have a bob haircut at present, you may want to try out clip in or weaving hair extensions.
    miu miu wristlet <p>Well it is said that even men these days are very fashion conscious and they also need a pair of sunglasses to protect ones eyes when out in direct contact to sun and even for a smarter and executive look. If you wearing a white collared shirt with a pair of black trousers then you must be looking for a pair of accessory, which completes your attire, believe me you should go for Burberry sunglasses for men, which will surely complete your formal looks. We will here suggest you the most popular and highly demanded sunglasses.
    miu miu bags sale <p>This movie, often wrongly called the worst movie of most time, is something to look at only if to express you did. Nearly so alarming as tedious, it takes a large amount of will to make it through, but there are several bright spots, just like the people of the Grasp and Torgo. Discussing with buddies breaking bad is likely to make this video a great deal more tolerable.</p>.
    miu miu wristlet <p>The modern violin was developed in Italy in the sixteenth century using the techniques used in a variety of other stringed instruments, but mainly the viol. The viol had more strings than we see on the violin and the body was not convex, but was flat. The most famous violin in the world is the Stradivarius, named after its maker, Antonio Stradivari from the Italian town of Cremona.
    miu miu sale The group outperformed a bit yesterday after Cypress (CY +2.9%) announced it's merging with Spansion (CODE +2.5%), continuing the chip industry's consolidation wave. Several firms have upgraded Cypress and/or Spansion in response, praising the deal's cost synergies. Notable gainers include not only chipmakers, but also chip equipment, test/assembly, and IP licensing firms: ARMH +3.8%.
    miu miu glitter They will not suit all people in all cases so depending upon the situation and the condition the person should act accordingly make their affair a success without being caught or making it public. Having an affair can be successful only if you follow some norms and regulations and maintain it safely and keep it away from the public as far as possible. Here are some tips .
    miu miu matelasse clutch <p>Sport Sunglasses, there are many kind of sport glasses like water resistant sunglasses designed for water sports, durable and lightweight sunglasses designed for rock climbing, and sunglasses designed for any sport in between. Most sport sunglasses come with scratch resistant lenses. Popular sports sunglass brands include Oakley sunglasses, Arnette sunglasses, and Native sunglasses.
    miu miu glitter booties <p>Teeth Whitening Options For That Picture Perfect SmileConstantly drinking coffee, tea or red wine will result in Surface Stain on your teeth. The more serious stains are the internal stains. To enhance your smile when you have internal stains your options range from Dental Implants and Dental Veneers to Laser Teeth Whitening.</p>.
    miu kee falls church <p>In the state of pregnancy, you need to think twice and deeply before you take any type of medication. Because the medication affects you, and the growing baby within! Therefore, headache, during pregnancy, becomes the highly unfavorable experience. But all pregnant women have to undergo this suffering.
    miu miu mary jane
     
    Last edited by a moderator: Feb 1, 2015

Share This Page