Folder rename preset

Any questions? Need some help?
Post Reply
mosteanuv
Posts: 4
Joined: 18 May 2022, 10:32

Folder rename preset

Post by mosteanuv »

Hey guys,

Love the app but I can't figure out how to rename a folder with the name of the files that are inside it.

Ex:
"Captain America / Captain America / captain america s03e01.mkv"
to become
"Captain America / Captain America s03/ captain america s03e01.mkv"

even if it becomes
"Captain America / Captain America s03e01/ captain america s03e01.mkv" it is ok because I can bulkrename it
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Folder rename preset

Post by rednoah »

e.g.

Code: Select all

X:/{n}/{n} S{s.pad(2)}/{n} {s00e00} {t}
:arrow: Please read FAQ #1 and learn how format expressions work.



:idea: Since you're just rewriting the file path using only information already in the file path, Plain File Mode can also work in this case:

Code: Select all

{f.dir.dir}/{fn.match(/s\d+/)}/{fn}
:idea: Please read the FAQ and How to Request Help.
mosteanuv
Posts: 4
Joined: 18 May 2022, 10:32

Re: Folder rename preset

Post by mosteanuv »

That worked like magic! Thank you!
mosteanuv
Posts: 4
Joined: 18 May 2022, 10:32

Re: Folder rename preset

Post by mosteanuv »

This code that was suggested : "{f.dir.dir}/{fn.match(/s\d+/)}/{fn}" stopped working.

I found a code that recreates what I wanted: "{f}/{fn.match(/s\d+/)}/{fn}" ... but nothing happens when I click rename
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Folder rename preset

Post by rednoah »

What does "nothing" look like exactly? Screenshot? Keep in mind that we don't see what you can see, so we can't really help you unless you help us see what you see.


:?: You will always get a success message, or an error message if something doesn't work. What does the message say?


:?: If "nothing" happens for one use case. Does "something" happen if you try something else? Can you narrow down what works and what doesn't?


:arrow: Here's a video tutorial for Plain File Mode so you can compare what you're doing to that, and perhaps find a significant difference. Is this what you are doing? If not, what are you doing differently?
https://youtu.be/hTNXS5aNArQ




EDIT:

I had time to run a test, and the OS cannot perform the operation (and so FileBot will display an error message to that account) because you're using {f} ... current file path as target folder path, so that of course can't work, because that file path already is that file, so it can't be a folder, and even if it was a folder, it can't be moved to within itself:

Code: Select all

MOVE: /path/to/X.mp4 -> /path/to/X.mp4/X.mp4: Not a directory
(this kind of operation would only be possible if FileBot were to automatically temporarily rename the file, then create a folder where the file used to be, and then move the file into the newly created folder)


NO:

Code: Select all

{f}/{fn}
YES:

Code: Select all

{f.dir}/{fn}
The {f.dir} captures the parent folder. Depending on how your files are currently organized, you may need to capture different parts of the current file path to generate the target file path you want, so this part of your custom format may need to be adjusted depending on the files at hand.
:idea: Please read the FAQ and How to Request Help.
Post Reply