[Help] Rename Script for Total Commander

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
SonOfDiablo
Posts: 8
Joined: 11 Feb 2019, 10:11

[Help] Rename Script for Total Commander

Post by SonOfDiablo » 11 Feb 2019, 10:15

Hello,

I'm attempting to write a script that will rename a list of given files.
My intend is to use it with Total Commander to rename selected files.

I have had this working before, but I sadly lost all my data and thus also the script I was using and I just can't seem to figure out how to structure the script to rename specific file.


Any help on this issue would be greatly appreciated!

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

Re: [Help] Rename Script

Post by rednoah » 11 Feb 2019, 10:35

Well, I suppose it's a simple as doing a FileBot command line call, and then replacing the input file argument with some variables that are provided by Total Commander.
:idea: Please read the FAQ and How to Request Help.

SonOfDiablo
Posts: 8
Joined: 11 Feb 2019, 10:11

Re: [Help] Rename Script

Post by SonOfDiablo » 11 Feb 2019, 22:59

rednoah wrote:
11 Feb 2019, 10:35
Well, I suppose it's a simple as doing a FileBot command line call, and then replacing the input file argument with some variables that are provided by Total Commander.
Could I trouble you for an example of how one such command line call would look like?
I have tried to read up on it, but I can't seem to figure it out sadly

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

Re: [Help] Rename Script for Total Commander

Post by rednoah » 12 Feb 2019, 04:31

This is a question best asked at the Total Commander forum.

If you can figure out how to call any program on select files, then I can help you call filebot specifically on selected files.
:idea: Please read the FAQ and How to Request Help.

SonOfDiablo
Posts: 8
Joined: 11 Feb 2019, 10:11

Re: [Help] Rename Script for Total Commander

Post by SonOfDiablo » 12 Feb 2019, 08:33

rednoah wrote:
12 Feb 2019, 04:31
This is a question best asked at the Total Commander forum.

If you can figure out how to call any program on select files, then I can help you call filebot specifically on selected files.
Currently what I was trying is something like this:

Code: Select all

filebot -script fn:renall '%P%N' -non-strict --format "{n.upperInitial().space('.')}.{S00E00}.{t.upperInitial().space('.')}"
Where '%P%N' is the selected files.

This is what I get when trying:
Image

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

Re: [Help] Rename Script for Total Commander

Post by rednoah » 12 Feb 2019, 09:15

You're command line is somehow wrong.

It's best to learn how to use the command line tool first without Total Commander, and only integrate with TC once you already get the hang of it directly in CMD.

e.g. your first mistake is using ' which is ok in Unix bash but not Windows CMD.
:idea: Please read the FAQ and How to Request Help.

SonOfDiablo
Posts: 8
Joined: 11 Feb 2019, 10:11

Re: [Help] Rename Script for Total Commander

Post by SonOfDiablo » 12 Feb 2019, 09:49

rednoah wrote:
12 Feb 2019, 09:15
You're command line is somehow wrong.

It's best to learn how to use the command line tool first without Total Commander, and only integrate with TC once you already get the hang of it directly in CMD.

e.g. your first mistake is using ' which is ok in Unix bash but not Windows CMD.
So I tried it in PS and I got the following:
Image

Not really a useful message I have to say

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

Re: [Help] Rename Script for Total Commander

Post by rednoah » 12 Feb 2019, 10:02

Haha, it's a funny one isn't it?

It's a JRE error message, not specific to FileBot. It'll just say if the path is invalid, and then echo the path that's invalid.

In this case, ' is index 0, d is index 1 and : is index 2. So you get the error because index 1 is not : which means the path is not a valid Windows file path, and then it'll just repeat the invalid path, except ' is part of your invalid path, even though it might look like it's part of the error message on first glance.
:idea: Please read the FAQ and How to Request Help.

SonOfDiablo
Posts: 8
Joined: 11 Feb 2019, 10:11

Re: [Help] Rename Script for Total Commander

Post by SonOfDiablo » 12 Feb 2019, 10:57

rednoah wrote:
12 Feb 2019, 10:02
Haha, it's a funny one isn't it?

It's a JRE error message, not specific to FileBot. It'll just say if the path is invalid, and then echo the path that's invalid.

In this case, ' is index 0, d is index 1 and : is index 2. So you get the error because index 1 is not : which means the path is not a valid Windows file path, and then it'll just repeat the invalid path, except ' is part of your invalid path, even though it might look like it's part of the error message on first glance.
I think you are looking at the wrong image :)

The message I got was "Done ?(?????)?" which I do not really understand what means

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

Re: [Help] Rename Script for Total Commander

Post by rednoah » 12 Feb 2019, 11:11

Just means that Windows CMD can't display unicode characters, and that the script completed without errors.


Why does it not do anything? Because the renall script explicitly deal with folder structures:
viewtopic.php?t=5#p2211

:?: Since you have a very simple use case, that is covered by the the built-in commands just fine, I'm not quite sure why you're using the renall script. The renall script might be useful for large jobs, dealing with large file and folder structures in manageable chunks, and not processing a single file, which apparently doesn't do anything anyway. :lol:


You'll want to use the filebot -rename commands as documented in the manual:
https://www.filebot.net/cli.html
:idea: Please read the FAQ and How to Request Help.

SonOfDiablo
Posts: 8
Joined: 11 Feb 2019, 10:11

Re: [Help] Rename Script for Total Commander

Post by SonOfDiablo » 12 Feb 2019, 11:45

rednoah wrote:
12 Feb 2019, 11:11
Just means that Windows CMD can't display unicode characters, and that the script completed without errors.


Why does it not do anything? Because the renall script explicitly deal with folder structures:
viewtopic.php?t=5#p2211

:?: Since you have a very simple use case, that is covered by the the built-in commands just fine, I'm not quite sure why you're using the renall script. The renall script might be useful for large jobs, dealing with large file and folder structures in manageable chunks, and not processing a single file, which apparently doesn't do anything anyway. :lol:


You'll want to use the filebot -rename commands as documented in the manual:
https://www.filebot.net/cli.html
huh, that worked.. I could have swore I had tried that already... Thanks man!
I really appreciate all of your help and time!



If anyone else reads this thread here is my solution:

Code: Select all

Command: filebot
Parameters: -rename %P%N -non-strict --format "{n.upperInitial().space('.')}.{S00E00}.{t.upperInitial().space('.')}"
Start Path: <Blank>

SonOfDiablo
Posts: 8
Joined: 11 Feb 2019, 10:11

Re: [Help] Rename Script for Total Commander

Post by SonOfDiablo » 12 Feb 2019, 12:04

rednoah wrote:
12 Feb 2019, 11:11
Just means that Windows CMD can't display unicode characters, and that the script completed without errors.


Why does it not do anything? Because the renall script explicitly deal with folder structures:
viewtopic.php?t=5#p2211

:?: Since you have a very simple use case, that is covered by the the built-in commands just fine, I'm not quite sure why you're using the renall script. The renall script might be useful for large jobs, dealing with large file and folder structures in manageable chunks, and not processing a single file, which apparently doesn't do anything anyway. :lol:


You'll want to use the filebot -rename commands as documented in the manual:
https://www.filebot.net/cli.html
Actually, this is all good for one file at a time, but how would one go about renaming multiple files?
Specifically a few select files and not a whole folder.

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

Re: [Help] Rename Script for Total Commander

Post by rednoah » 12 Feb 2019, 14:24

Passing one file argument works exactly the same as passing many file arguments.

1 select file:

Code: Select all

filebot -rename Alias.1x01.mp4
2 select files:

Code: Select all

filebot -rename Alias.1x01.mp4 Alias.1x02.mp4
3 select files:

Code: Select all

filebot -rename Alias.1x01.mp4 Alias.1x02.mp4 Alias.1x03.mp4
Many select files:

Code: Select all

filebot -rename *.mp4
:idea: Please read the FAQ and How to Request Help.

SonOfDiablo
Posts: 8
Joined: 11 Feb 2019, 10:11

Re: [Help] Rename Script for Total Commander

Post by SonOfDiablo » 12 Feb 2019, 19:54

Oh that is a lot easier than I thought it would have been!

I thank you again! I really appreciate all of your help!

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

Re: [Help] Rename Script for Total Commander

Post by rednoah » 13 Feb 2019, 04:42

And it works exactly the same way for any other reasonably well designed CLI tool. Transferable skills FTW. :lol:
:idea: Please read the FAQ and How to Request Help.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests