Rename File, Create Folder In Current Location, Put Newly Renamed File In New Folder
-
- Posts: 10
- Joined: 27 Feb 2018, 22:43
Rename File, Create Folder In Current Location, Put Newly Renamed File In New Folder
An example is given on this site that to (1) rename a movie file, (2) create a folder of the same name in the same location and (3) move the newly renamed file to the new folder, use this code:
../{movie}/{movie}
If I have a file
\\server\share\folder\Final.Portrait.2017.1080p.NF.WEBRip.DDP.5.1.H264-CMRG.mkv
and then I drag it into Filebot (GUI, of course), then I run the above preset, Filebot (1) properly renames the file and (2) creates a folder of the same name and (3) puts the new file in the new folder. However, the new folder is one level up in the file tree from where I ran the command. So instead of ending up with:
\\server\share\folder\Final Portrait (2017)\Final Portrait (2017).mkv
which is what I want, I end up with
\\server\share\Final Portrait (2017)\Final Portrait (2017).mkv
which is not what I want.
How should I change my code to achieve the desired result?
OS: Windows 10 Pro 64 bit
Filebot: Microsoft Store purchased, but version unknown - there's no "help, about" for me to check the program version and it doesn't show up in Control Panel \ Programs.
../{movie}/{movie}
If I have a file
\\server\share\folder\Final.Portrait.2017.1080p.NF.WEBRip.DDP.5.1.H264-CMRG.mkv
and then I drag it into Filebot (GUI, of course), then I run the above preset, Filebot (1) properly renames the file and (2) creates a folder of the same name and (3) puts the new file in the new folder. However, the new folder is one level up in the file tree from where I ran the command. So instead of ending up with:
\\server\share\folder\Final Portrait (2017)\Final Portrait (2017).mkv
which is what I want, I end up with
\\server\share\Final Portrait (2017)\Final Portrait (2017).mkv
which is not what I want.
How should I change my code to achieve the desired result?
OS: Windows 10 Pro 64 bit
Filebot: Microsoft Store purchased, but version unknown - there's no "help, about" for me to check the program version and it doesn't show up in Control Panel \ Programs.
Re: Rename File, Create Folder In Current Location, Put Newly Renamed File In New Folder
You have:
You want:
Because you want to create the folder in the current folder, and not the parent folder. .. refers to the parent folder of the file being processed, while . refers to the current folder of the file being processed.
TIP: If you specify exactly what you want in your format, then you will get exactly what you want.
TIP 2: I recommend using {plex} or {plex.tail} instead of {movie}/{movie} because that'll take care of various corner cases and special cases you may not think of until you run into certain problems.
Code: Select all
../{movie}/{movie}
Code: Select all
./{movie}/{movie}
TIP: If you specify exactly what you want in your format, then you will get exactly what you want.
Code: Select all
\\server\share\folder\{movie}\{movie}
Please read the FAQ and How to Request Help.
Re: Rename File, Create Folder In Current Location, Put Newly Renamed File In New Folder
Hello rednoah,
I would like to request your support for a scenario similar like this.
I'm renaming a Series that is in this path:
I want this output:
All the path before the Series Name changes depending on the input video.
if i use:
Then, the output is:
I tried with one more dot to go one level above like this:
But, I received this error:
Question:
What should be the correct sintax?
Thanks!
I would like to request your support for a scenario similar like this.
I'm renaming a Series that is in this path:
Code: Select all
C:\Tool\A\Output\Series Name\Season\Video_name.mkv
Code: Select all
C:\Tool\A\Output\New Series Name\New Season\New Video_name.mkv
if i use:
Groovy: Select all
../{n.upperInitial().lowerTrail()....}
Code: Select all
C:\Tool\A\Output\Series Name\New Series Name\New Season\New Video_name.mkv
Groovy: Select all
.../{n.upperInitial().lowerTrail()....}
Format: Select all
MOVE: Cannot create parent folder: C:\Tools\A\Output\...\Series Name (2023) {tmdb-xxxxx}\Season 01: Access Denied: C:\Tools\A\Output\...
What should be the correct sintax?
Thanks!
Re: Rename File, Create Folder In Current Location, Put Newly Renamed File In New Folder
Update:
I tried leaving it without "../" and now it works:
But earlier today, when I had the statements like that, it was moving the files as follows, directly into the drive root folder.
I tried leaving it without "../" and now it works:
Format: Select all
{n.upperInitial().lowerTrail()....}
Format: Select all
C:\New Series Name\New Season\New Video_name.mkv
Re: Rename File, Create Folder In Current Location, Put Newly Renamed File In New Folder
. refers to the current directory. .. refers to the parent directory. You can do ../../.. to refer to the parent of the parent of the parent and so on. See What are "." and ".." in a directory? for details.
What is the real path of C:\Tool\A\Output? This is likely a made up path for illustration purposes. However, if you were to use {plex} on this example path it would likely work because Output / Complete / Downloads / etc have special "structure root folder" meaning to FileBot, and so FileBot would be inclined to reorganize files within the common structure root if the format is relative.
That said, in this case I would probably go with "take the first 4 folder levels from the original file path" logic:
What is the real path of C:\Tool\A\Output? This is likely a made up path for illustration purposes. However, if you were to use {plex} on this example path it would likely work because Output / Complete / Downloads / etc have special "structure root folder" meaning to FileBot, and so FileBot would be inclined to reorganize files within the common structure root if the format is relative.
That said, in this case I would probably go with "take the first 4 folder levels from the original file path" logic:
Format: Select all
{ f[0..3] }
Please read the FAQ and How to Request Help.
Re: Rename File, Create Folder In Current Location, Put Newly Renamed File In New Folder
Hello rednoah,
C:\Tool\A\Output is for illustration, but, I have different folder names, A might be changed with another name, also, Output might be changed depending on the source.
What I understood so far, is that, Filebot takes the path of the video files, and, from that point, the parent directories starts to count.
Example:
If I use ..//, then, the files are moved to parent directory of the video files, in this case in the Season XX folder.
I will try your suggestions, thanks a lot for your support!
C:\Tool\A\Output is for illustration, but, I have different folder names, A might be changed with another name, also, Output might be changed depending on the source.
What I understood so far, is that, Filebot takes the path of the video files, and, from that point, the parent directories starts to count.
Example:
Format: Select all
C:\Tools\Series Name\Season XX\Episode_00.mkv
I will try your suggestions, thanks a lot for your support!
Re: Rename File, Create Folder In Current Location, Put Newly Renamed File In New Folder
What is the real path of C:\Tool\A\Output though? (NOTE: behaviour may depend on the real file path)
If you use {plex}, then maybe, depending on the current file structure and folder names. In the example above, C:\ is likely considered structure root, since Tools is not a known structure root folder.
If you use ../{plex} or {folder}/{plex} or ../../{plex} or {folder.dir}/{plex} and so on as format, then yes.
If you use {plex}, then maybe, depending on the current file structure and folder names. In the example above, C:\ is likely considered structure root, since Tools is not a known structure root folder.
Please read the FAQ and How to Request Help.