Renaming Files without Database

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
dapersa
Posts: 8
Joined: 23 Jun 2017, 21:59

Renaming Files without Database

Post by dapersa »

Hello everybody,

I am new and I hope I am posting this on the right topic.

My father and I have a huge collection of movies, recorded on TV for the last 10 years with several thousand movies, specially classics, that are not available as DVD anymore. He started ripping these for using it on Plex.

He named all of the files like this: "Citizen Kane (Orson Welles-1941)", and I would like it to be "Citizen Kane (1941) - Orson Welles", so that it is a better order, and Plex will understand the movie year.

I found filebot, and it is great, but I don't understand it clearly. Is it always necessary to get Data from some online MDBs? I would like it to understand, that every of these thousands of movies is named "{t} ({director}-{y})" and rename it in "{t} ({y}) - {director}", without me checking every single file. (Specially since it has some problems finding the right movies, since we named all of them in german.

I don't know if I am having a problem finding the function, or it is not possible to do that.

I would be very happy, if I could get an answer regarding my problem.

Thank you very much in advance,
Greets from Germany,
dapersa :)
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Renaming Files without Database

Post by kim »

I spend some time on this just for you ;)

Code: Select all

{fn.replaceFirst(/(^.+)\(([^\)]+)-((?:19|20)\d{2})\)/, '$1($3) - $2')}
e.g. if you use the GUI then
1. drag&drop files on "Original Files"
2. press F2 key
3. Click on any file under "New Names" and use my format
4. press "Rename"
5. DONE :)

only local and no lookup is done, afaik

You can try and make your own formats here:
http://regexr.com/
http://www.regexplanet.com/advanced/java/index.html
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Renaming Files without Database

Post by rednoah »

Yes, as kim explained, you can use Plain File Presets which allows you to rewrite the filename with Groovy code. Using Regular Expressions is a good choice for these kinds of pattern matching tasks.

@see viewtopic.php?f=3&t=2072
@see viewtopic.php?f=3&t=3228
:idea: Please read the FAQ and How to Request Help.
dapersa
Posts: 8
Joined: 23 Jun 2017, 21:59

Re: Renaming Files without Database

Post by dapersa »

Thank you very much, kim and rednoah.
It worked great, specially your code is perfect. I still do not exactly understand each part of it, but I think I am slowly getting an overview. I'll try making my own codes too. Thanks!

One more question: We have a Synology Diskstation, and I installed Filebot Node on it right now. Does it work the same way here, or do I have to pay special attention to something, since the UI looks different.

Thanks!
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Renaming Files without Database

Post by rednoah »

You will not be able to do this via FileBot Node. However, you can login via SSH and use filebot on the command-line and that'll work.

Here's some examples of how to use FileBot on the command-line:
viewtopic.php?t=4788
:idea: Please read the FAQ and How to Request Help.
dapersa
Posts: 8
Joined: 23 Jun 2017, 21:59

Re: Renaming Files without Database

Post by dapersa »

Oh okay, I see. I've downloaded Putty and logged in via SSH and now I am in filebot on command-line.
Unfortionately I am getting errors, since I don't really understand what I am doing wrong.

I created a Folder " with several files in the wrong Name order, like I mentioned before. Now I tried several times, but I don't understand what line I should use to get the same effect as in the Windows version.

I am sorry for taking your time, but I would be really happy if someone could tell me how to integrate Kims code into the ssh version of Filebot.

Code: Select all

{fn.replaceFirst(/(^.+)\(([^\)]+)-((?:19|20)\d{2})\)/, '$1($3) - $2')}
Thanks again in advance. :)
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Renaming Files without Database

Post by rednoah »

The the command-line, you can use --db xattr -non-strict to rename generic files:

e.g.

Code: Select all

filebot -rename /files --db xattr -non-strict --format "{fn.ascii()}"
You can replace --format with your format. Be aware of escaping arguments correctly.


:idea: Use the @file syntax for reading command-line arguments from external text files.
:idea: Please read the FAQ and How to Request Help.
Post Reply