Complex Batch File Renaming - Remove characters between point A & B

Discussion in 'macOS' started by m021478, May 21, 2010.

  1. m021478 macrumors 6502

    Joined:
    Nov 23, 2007
    #1
    I have backed up (ripped) nearly all of my DVD Movies over the years, and most of them follow a naming convention similar to this:

    - Armageddon (1998) DVDRip XviD AC3.mp4
    - American Beauty (1999) DivX MP3.m4v​

    As you can see from the above examples, I initially named the files using a bunch of tech specs in the file name itself (DVDRip; DivX; MP3; etc)

    I am now trying to figure out a way that I can remove all information between the close parenthesis symbol ")" and the "." symbol of the file extension? To clarify using the example files above, I'd like to rename them to:

    - Armageddon (1998).mp4
    - American Beauty (1999).m4v​

    Does anyone know any way to accomplish something like this? Perhaps with the use of an applescript, or even a third party file renamer such as "A Better Finder Renamer"?

    Any suggestions would be greatly appreciated... Thanks!
     
  2. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #2
    Don't try to do it in Finder. Instead, the iTunes tags are probably in better condition. So make sure the tags are correct in iTunes, then auto-rename your files from that.

    Doug's AppleScripts for iTunes is a great resource for managing your iTunes tags and files.

    File Renamer

    For most other file renaming, try Name Mangler
     
  3. m021478 thread starter macrumors 6502

    Joined:
    Nov 23, 2007
    #3
    Many of the movies I've ripped aren't necessarily in my iTunes Library, because as the years have gone by, I've found myself ripped in different formats for different reasons.

    I have lots of non-iTunes compatible .divx, .avi, .mkv, etc. movies which I won't be able to use an iTunes script to rename...

    Any other suggestions?
     
  4. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #4
    Like I said, Name Mangler can help, especially if you have several files ending with " DVDRip XviD AC3". You can simply replace that string with nothing, then do the next string, etc.
     
  5. m021478 thread starter macrumors 6502

    Joined:
    Nov 23, 2007
    #5
    I don't suppose you would have any idea how to tell name mangler (or A Better Finder Renamer) to remove all characters between the close parenthesis symbol ")" and the "." symbol of the file extension?

    I am sure this can be done using regular expressions, though I haven't got the slightest Idea how to go about doing it!

    This overview of 'Regular Expressions' was about as far as I got Google-ing for a solution before I realized I was in over my head...

    Anyone have any idea how to use regular expressions to specify a 'wildcard' of sorts that would instruct one of these apps to rename a file by deleting all characters between the close parenthesis symbol ")" and the "." symbol of the file extension?
     
  6. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #6
    I don't know of any app that can do that, using two characters as boundaries for deleting everything in between.

    However, with Name Mangler (I can't speak for other apps, since this is the only one I use for this), you can use several operations, such as replacing every occurrence of "DVDRip" with "", then every "XviD", then every "DivX", etc. and finally, replace every " " (double space) with " " (single space).

    Name Mangler also enables you to remove any number of characters from the front or back, beginning with any character you choose. It's really quite robust in its capabilities.
     
  7. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #7
    For the regex replace, set the find to ").*$" w/o quotes. Make sure preserve extension is selected. Then for the replace field, use ")"

    The preview of the new file name should ensure that it's doing the proper replace.
     
  8. m021478 thread starter macrumors 6502

    Joined:
    Nov 23, 2007
    #8
    Thanks so much for the tip. However I am currently using "A Better Finder Renamer" (very similar to Name Mangler), which also has regex capabilities, but the regex snippet you provided doesn't seem to work properly - at least, as I've attempted with applying it with ABFR.

    Any suggestions?

    [​IMG]

    I also tried your suggestion using Name Mangler and it doesn't work??

    Any ideas?
     
  9. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #9
    It's possible the ) needs to be escaped. Add a \ in front of it. And what do you mean by "doesn't work," e.g., does no replacement, wrong replacement, etc.?
     
  10. m021478 thread starter macrumors 6502

    Joined:
    Nov 23, 2007
    #10
    That did the trick! Simply adding a "\" in front of the string that was previously provided made it work!

    Here's the before:
    [​IMG]

    ...and after:
    [​IMG]

    Thanks so much for everyone's help in getting this figured out! This will certainly be a huge time saver!
     

Share This Page