preserving Collection subfolder names when mixed with single movie subfolders

Support for macOS users
Post Reply
yhm28
Posts: 27
Joined: 24 Jan 2018, 07:20

preserving Collection subfolder names when mixed with single movie subfolders

Post by yhm28 »

For example a set of movies, where each movie is in an identically named parent folder, with some grouped into "Collection" folders

Code: Select all

Movies/ (top folder)
Movie 1 (year)/Movie 1 (year).mkv
Movie 2 (year)/Movie 2 (year).mkv
Movie 3 (year)/Movie 3 (year).mkv
# COLLECTION - Superman/ (subfolder within Movies)
Superman Movie 1 (year)/Superman Movie 1 (year).mkv
Superman Movie 2 (year)/Superman Movie 2 (year).mkv
Superman Movie 3 (year)/Superman Movie 3 (year).mkv
What expression (if any) can preserve this structure? Or will I have to do each "Collection" folder individually?
User avatar
rednoah
The Source
Posts: 23922
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: preserving Collection subfolder names when mixed with single movie subfolders

Post by rednoah »

:idea: You can use {folder} to use the current folder in your format.


e.g. rename files in place, explicitly by generating absolute file paths with the same parent folder path:

Format: Select all

{ folder }/{ plex.name }


:idea: You can do things like folder[0..2] or folder[-3..-1] or folder[1..-2] to get the first N or last N or N in-between path components, but you may find it difficult to programmatically know if a file path contains a collection folder or not and which specific folder levels are part of the path you want to preserve. In this case I'd probably just do "take everything after the /Movies/ bit" like so:

Format: Select all

{ folder.path.after(/[\/\\]Movies[\/\\]/) }


:idea: {relativeFile} may also work, but this one is more magical as it relies on FileBot internals to detect the "structure root" folder to then take the remaining file path from there:

Format: Select all

{ relativeFile.dir }
:idea: Please read the FAQ and How to Request Help.
Post Reply