Page 1 of 1

Renaming Files without Database

Posted: 23 Jun 2017, 22:13
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 :)

Re: Renaming Files without Database

Posted: 24 Jun 2017, 01:46
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

Re: Renaming Files without Database

Posted: 24 Jun 2017, 03:24
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

Re: Renaming Files without Database

Posted: 24 Jun 2017, 08:57
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!

Re: Renaming Files without Database

Posted: 24 Jun 2017, 09:26
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

Re: Renaming Files without Database

Posted: 24 Jun 2017, 10:14
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. :)

Re: Renaming Files without Database

Posted: 24 Jun 2017, 10:47
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.