Rename Folders Too

Any questions? Need some help?
Andrewch
Posts: 3
Joined: 14 Mar 2012, 11:22

Rename Folders Too

Post by Andrewch »

Hello,

Hopefully this is not covered elsewhere. Can Filebot rename folders when naming movies? My XBMC collection uses the folder names.

Finally, thanks for the program. Amazing!

Cheers
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Folders Too

Post by rednoah »

Sure, just define your paths in the naming scheme. Absolute or Relative paths all ok. Just set the naming pattern you want.

e.g.

Code: Select all

E:/Movies/{movie}/{movie}
or

Code: Select all

../{movie}/{movie}
:idea: Please read the FAQ and How to Request Help.
Andrewch
Posts: 3
Joined: 14 Mar 2012, 11:22

Re: Rename Folders Too

Post by Andrewch »

Thanks Rednoah,

Ill give it a go when I get home.

Cheers
Andrewch
Posts: 3
Joined: 14 Mar 2012, 11:22

Re: Rename Folders Too

Post by Andrewch »

It took a while to get to it but it works great. Thanks for this
MasterCATZ
Posts: 38
Joined: 28 May 2012, 23:01

Re: Rename Folders Too

Post by MasterCATZ »

Using This now to rename Folders

../{n}/{n} - {s00e00} - {t} [{airdate}]


how ever it not renaming the folder it seems to be creating folder then moving the renamed files into it

ie) the original folder is still their

and I made sure I did not have the folder still accessed :P
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Folders Too

Post by rednoah »

FileBot doesn't delete anything or cleanup remaining folders/files.

1. Why not move things into a new clean structure and just don't care about what's left behind? e.g. E:/sorted/TV/{n}/{n} - {s00e00} - {t} [{airdate}]

2. Or you can use the cleaner script, i.e. filebot -script fn:cleaner /path/to/remainder
:idea: Please read the FAQ and How to Request Help.
MrMax
Posts: 15
Joined: 21 Oct 2012, 14:48

Re: Rename Folders Too

Post by MrMax »

I'm a total newbie and don't get some of the stuff with these codes, but tried using this:
../{movie}/{movie} to rename both the file and directory and succeeded, HOWEVER, what FileBot does is:

1. creates a new directory with the proper (new) name
2. renames the movie file and MOVES it to that directory
3. leaves the old directory intact with any other files that might have been there to begin with (e.g. cover art)

This is a problem for a couple of reasons:
1. You have to manually delete old directories
2. If you have other contents in a given directory, such is cover art, those files are left alone and you have to move everything manually to the new directory. Needless to say this defeats the purpose of using FileBot because it creates more work instead of simplifying it.

I'm sure there's gotta be an easier and better way to do it. I've seen posts on the forum with all sorts of java codes that need to be edited in the .jar file. I was able to open the .jar with zip-7 and can edit it, but the instructions on these pages often don't specify which line(s) are to be edited. For the above task, I'd really like something simple and straightforward. I don't want FileBot to move anything, rather just simply rename the file and the directory it sits in.

Thank you!
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Folders Too

Post by rednoah »

1. Deleting left-overs? There's a script for that:
http://filebot.sourceforge.net/forums/v ... &t=5#p1341

1.1. Fetching artwork/nfo? Also scripts for that:
TV Shows => http://filebot.sourceforge.net/forums/v ... 4&t=5#p204
Movies => http://filebot.sourceforge.net/forums/v ... 4&t=5#p205


2. FileBot will treat a folder as a single unit if it's either a DVD/BR etc folder OR if there is a file called movie.nfo in that folder in which case the folder will be moved/copied/etc as a whole as if it were a single file.

2.1. The posts you referred to where about modifying the patterns to include not just movie.nfo but anything.

That would done by modifying net/sourceforge/filebot/media/ReleaseInfo.properties and adding another pattern to this line, e.g. .+ for matching anything:

Code: Select all

pattern.diskfolder.entry: BDMV|HVDVD_TS|VIDEO_TS|AUDIO_TS|VCD|movie.nfo|.+

PS:
Also with scripting you can just pass in a folder as single file. But with zero scripting experience it's maybe not that easy. Still, I'd be like 2-3 lines of code:

Code: Select all

def movies = args.getFolders{ *** my movie folder selection code *** }
rename(file:movies, db:'TheTVDB', ...)
:idea: Please read the FAQ and How to Request Help.
MrMax
Posts: 15
Joined: 21 Oct 2012, 14:48

Re: Rename Folders Too

Post by MrMax »

Thank you for a prompt reply. I don't want to delete any leftovers. I want to keep my old cover art and other files in the directory, don't need to download them. And most importantly, I don't want FileBot to MOVE or COPY anything, just simply rename the old file and folder and leave them where they were. As if you were to go in with a simple file manager and just rename your files and folders. Everything in them remains intact.

As far as the code you provided, I can use zip-7 to edit .jar, no problem, but I need to know where exactly to insert those lines?
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Folders Too

Post by rednoah »

Just finished editing the post above and included the extra info. That'll only allow you to RENAME folders. When I say moving I mean rename, as it's the same thing. :P
:idea: Please read the FAQ and How to Request Help.
MrMax
Posts: 15
Joined: 21 Oct 2012, 14:48

Re: Rename Folders Too

Post by MrMax »

Tried to edit .jar by adding the code to the very end of Releaseinfo.properties but not sure if that's the right way to do it? I've noticed all other lines in the script are preceded by a line in green, except this one.

Also, 7-zip wouldn't allow me to save the file due to unspecified error and cannot update archive. I installed x64 version of FileBot but noticed that it installs itself in x86 directory! I tried reinstalling but it still wants to go to Program Files (x86). Why?
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Folders Too

Post by rednoah »

1. If you wanna edit the jar just download the portable. I'm pretty sure Windows won't allow you to modify files in any of the system/programs folders. Maybe if you run 7zip as admin it could work.

2. Are you sure you got the x64 msi installer? Maybe uninstalling everything first helps? But that's all Microsoft Installer doing it's thing, there shouldn't be any major issues such as this. I can't even install the x64 msi package on my x86 machine since MSI installer will just say NO.
:idea: Please read the FAQ and How to Request Help.
MrMax
Posts: 15
Joined: 21 Oct 2012, 14:48

Re: Rename Folders Too

Post by MrMax »

OK, was able to edit the file by copying it to another location. Win7 does not easily allow access to Program Files folders. But still not sure if I added the code properly. Doesn't look right as I noted in the above post. I tried renaming a file/directory, still same thing, it's moving it to a new location.
MrMax
Posts: 15
Joined: 21 Oct 2012, 14:48

Re: Rename Folders Too

Post by MrMax »

Yes, I got FileBot_3.0_x64.msi. It installs in (x86)
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Folders Too

Post by rednoah »

1.
Well, it works when you drop in a folder it'll not list the files in the folder but just have a single entry for that folder with the label 'Folder' next to it (as opposed to avi mkv etc as usual).

You can try that by creating a movie.nfo file in one of your movie folders and then dropping that in.

2.
Can you confirm that it's a problem on other 64-bit Windows computers as well and not just an isolated issue on your machine?

I'll have a look at that installer issue but since I only have a x86 machine I can't really do much about it. Maybe there is an obvious solution in the installer properties somewhere.
:idea: Please read the FAQ and How to Request Help.
MrMax
Posts: 15
Joined: 21 Oct 2012, 14:48

Re: Rename Folders Too

Post by MrMax »

I have only one x64 computer. I have various 64-bit programs and they all properly install on that computer.

Thank you for the drag'n'drop folder info, that's pretty straightforward. What I'm not sure is whether I edited .jar file properly as I described above. I'm away from my computer but will test it again later. What I did was simply copy/paste your info into .jar file as you posted at the end of the ReleaseInfo.properties:

def movies = args.getFolders{ *** my movie folder selection code *** }
rename(file:movies, db:'TheTVDB', ...)

Do I need to edit any of the above lines when adding into .jar file? If so, how exactly?
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Folders Too

Post by rednoah »

Nope, that script would be one way to rename movie folders if you where to use the cmdline and Groovy scripting without any modification to the jar.

What you're doing is you're making FileBot recognize any folder as disk folder. That'll only affect what happens when you drag-n-drop folders into the FileBot GUI.

That pattern.diskfolder.entry tells pattern when a folder is considered a diskfolder (handle folder as single file) or when a folder is considered collection of files. It's just a regular expression, if any file in a folder matches that expression than that folder is just added to the list as is, otherwise we'd add the files in that folder.

Normally it's folders called BDMV or VIDEO_TS, or a file called movie.nfo, or in case of that modification .+ which means any filename.

Long story short, that one line I pasted is all you need, just copy & replace.
:idea: Please read the FAQ and How to Request Help.
MrMax
Posts: 15
Joined: 21 Oct 2012, 14:48

Re: Rename Folders Too

Post by MrMax »

The code you provided "pattern.diskfolder.entry: BDMV|HVDVD_TS|VIDEO_TS|AUDIO_TS|VCD|movie.nfo|.+" works great on folders, but leaves the movie file name unchanged. What other info is missing so that both the movie name and folder are renamed at the same time?

Also, I've noticed that if I drag/drop the main folder, e.g. "My Movies" which contains several movies, FileBot does not understand that there are subfolders with movies, therefore, it does not perform any operation on these. Is it possible to instruct it to read the entire tree (all subfolders)?

I realize that FileBot is a powerful little program if you know the java coding, but for a layperson there should be some kind of accessible config file, just like any other windows program has it, where you could select any options you like. Not sure if in this case java is the limiting factor?
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Folders Too

Post by rednoah »

Well, I could have a thousand options for you to configure, but that would be a lot of work, and then nobody would understand it anyway. My design is all about efficiency, automate everything that can be automated, figure everything out auto-magically.

I'm uploading r1251 here:
http://sourceforge.net/projects/filebot ... ebot/HEAD/

Features:
* hopefully fixed some of the issues with the 64-bit install (please test, may or may not work)
* if you link-drop (Shift+Control+Drop) folders it will be added as file, and not resolved to files in the folder, maybe not obvious at first but very efficient, more then a setting you have to enable/disable anyway :P

That way you can just do it in 2 passes. Drop folders with link-drop and rename to rename the folders, drop folders again with move-drop to rename the files inside the folder.


PS:
Java a limiting factor? By modifying the .jar did something equivalent to modifying an .exe file. The only reason you can edit that setting is because it's Java. ;)

PS2:
By making that change with .+ you precisely disabled the "read the entire tree" logic. See why this is a setting I can't let people just edit? :P Of course you can get around that with replacing .+ with .avi$|.mkv$ to only activate that logic for movie folders. Anyway, with r1251 and the new link-drop trick you won't need that anymore. ;)
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

fn:renall

Post by rednoah »

Updated fn:renall with an extra option to make it target movie folders for renaming rather than single files:

Code: Select all

filebot -script fn:renall "path/to/movies" --db TheMovieDB -non-strict --def target=folder
I recommend first running it in test mode to see if everything is detected alright:

Code: Select all

filebot -script fn:renall "path/to/movies" --db TheMovieDB -non-strict --def target=folder --action test --log info
EDIT:
Listed fn:renall with the others => http://filebot.sourceforge.net/forums/v ... 2211#p2211
:idea: Please read the FAQ and How to Request Help.
MrMax
Posts: 15
Joined: 21 Oct 2012, 14:48

Re: Rename Folders Too

Post by MrMax »

Great news! The revision is great, installs as x64.

Wish I could rename both folder and file in a single step, but as long as I have a working solution, it's fine.

The last two scripts you provided fn:renall are for Groovy? I don't see anything like that in .jar. Please, clarify.

Just out of curiosity - what's the difference btw filebot.platform.launcher.exe and filebot.launcher.exe? They both bring up the GUI, but one looks darker.

Thanks for all your help and good work.
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Folders Too

Post by rednoah »

Good news! x64 msi is sorted then.

1. Yes, it's Groovy code, but with lots of extras so you can hook into FileBot functions. And FileBot can run Groovy scripts => filebot -script <script> <options> ... Is that what you mean?

2. This has nothing to do with the contents of the .jar (again this is like an .exe, just because you can doesn't mean should mess with the internals).

If you don't know what to do with this piece of code you really need to read up on how to use the commandline. ;)

Code: Select all

filebot -help
filebot.launcher.exe uses filebot.launcher.l4j.ini as startup config
filebot.platform.launcher.exe uses filebot.platform.launcher.l4j.ini as startup config
(yep, that's my config files, but again that's stuff you shouldn't need to mess with normally :P)

Just open the .l4j.ini files and see what it's setting up. Basically the *.platform.launcher is a kinda fail-safe that forces FileBot to run as platform-independent as possible (as a workaround for platform specific problems that can crash things). Use Nimbus UI instead of Windows UI, Java APIs for renaming/moving instead of the Windows Shell, disable Direct3D accl so you won't have issues with RDP, etc
:idea: Please read the FAQ and How to Request Help.
MrMax
Posts: 15
Joined: 21 Oct 2012, 14:48

Re: Rename Folders Too

Post by MrMax »

Commandline? Why didn't you say so. I'm a DOS kind of guy... LOL

Thanks again. I'll play with help. I'm sure it offers many options.
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename Folders Too

Post by rednoah »

Awesome! Then scripting is not a problem for you! And by scripting I mean just starting up a cmd and calling the built-in stuff or any of my scripts. ;)
http://filebot.sourceforge.net/forums/v ... f=4&t=5#p5
:idea: Please read the FAQ and How to Request Help.
afsd
Posts: 6
Joined: 01 Nov 2012, 03:02

Re: fn:renall

Post by afsd »

rednoah wrote:Updated fn:renall with an extra option to make it target movie folders for renaming rather than single files:

Code: Select all

filebot -script fn:renall "path/to/movies" --db TheMovieDB -non-strict --def target=folder
I recommend first running it in test mode to see if everything is detected alright:

Code: Select all

filebot -script fn:renall "path/to/movies" --db TheMovieDB -non-strict --def target=folder --action test --log info
EDIT:
Listed fn:renall with the others => http://filebot.sourceforge.net/forums/v ... 2211#p2211
I have run this command via web console on my Synology NAS drive, and it renames the "root" movie folder (so in your "path/to/movies" example above, it renames the "movies" folder), and then it fails to find any media files in the rest (because now all these folders do not exist, as they have been 'moved' into the newly renames 'movies' folder)

My 'root' movies folder is called "ToSort", and it renames it to "Disney's Fables Volume 1 (2003)". Lol. (I do not have this movie in my folder, no idea why it renames it to that)

Hope you can help.
Thanks
Post Reply