Page 1 of 1

[Help] Rename Script for Total Commander

Posted: 11 Feb 2019, 10:15
by SonOfDiablo
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!

Re: [Help] Rename Script

Posted: 11 Feb 2019, 10:35
by rednoah
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.

Re: [Help] Rename Script

Posted: 11 Feb 2019, 22:59
by SonOfDiablo
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

Re: [Help] Rename Script for Total Commander

Posted: 12 Feb 2019, 04:31
by rednoah
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.

Re: [Help] Rename Script for Total Commander

Posted: 12 Feb 2019, 08:33
by SonOfDiablo
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

Re: [Help] Rename Script for Total Commander

Posted: 12 Feb 2019, 09:15
by rednoah
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.

Re: [Help] Rename Script for Total Commander

Posted: 12 Feb 2019, 09:49
by SonOfDiablo
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

Re: [Help] Rename Script for Total Commander

Posted: 12 Feb 2019, 10:02
by rednoah
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.

Re: [Help] Rename Script for Total Commander

Posted: 12 Feb 2019, 10:57
by SonOfDiablo
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

Re: [Help] Rename Script for Total Commander

Posted: 12 Feb 2019, 11:11
by rednoah
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

Re: [Help] Rename Script for Total Commander

Posted: 12 Feb 2019, 11:45
by SonOfDiablo
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>

Re: [Help] Rename Script for Total Commander

Posted: 12 Feb 2019, 12:04
by SonOfDiablo
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.

Re: [Help] Rename Script for Total Commander

Posted: 12 Feb 2019, 14:24
by rednoah
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

Re: [Help] Rename Script for Total Commander

Posted: 12 Feb 2019, 19:54
by SonOfDiablo
Oh that is a lot easier than I thought it would have been!

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

Re: [Help] Rename Script for Total Commander

Posted: 13 Feb 2019, 04:42
by rednoah
And it works exactly the same way for any other reasonably well designed CLI tool. Transferable skills FTW. :lol: