Recursive Rename of TV folders to add series date

All about user-defined episode / movie format expressions
Post Reply
itzak
Donor
Posts: 11
Joined: 30 Aug 2016, 10:39

Recursive Rename of TV folders to add series date

Post by itzak » 05 Nov 2019, 11:24

Batch rename TV Folders adding Series Began Date

I have the following naming convention that I am happy with. However a lot of folders that do not contain the date of the series. I would like to recursively rename the folders that are missing dates in place, touching nothing else. Can you help me with what the command line in windows should look like to do this?

Code: Select all

F:/TV//{n.sortName('$2, $1')} ({y})/Season {s.pad(2)}  ({y})//{n.sortName('$2, $1')} ({y}) - {s00e00} - {t} - Qbittorent - {vf}
Sorry if I'm a bother, I'm a paying customer and not proficient at scripting, but I did come up with the naming scheme above after much work on my own.

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

Re: Recursive Rename of TV folders to add series date

Post by rednoah » 05 Nov 2019, 11:46

Your format works as far as I can tell:

Code: Select all

F:/TV/Firefly (2002)/Season 01 (2002)/Firefly (2002) - S01E01 - Serenity - Qbittorent - 720p

:?: Presumably, you mean to say that {y} doesn't yield a value in same cases? Can you provide a sample file path / series / episode where this is the case?


:?: Are you processing files that have previously been processed with FileBot? But are somehow missing the year part?


:idea: Screenshots are generally extremely helpful and can safe both of us a lot of time. ;)


:!: Conceptually, FileBot does not rename folders. You're always processing a set of files. However, you can do things like "Only load files that contain 4 digits in the file path at the 3rd folder level?" quite easily via Presets. You can also re-apply a new format to previously processed files quickly without matching by pressing F2. Perhaps you could give more context to what you're trying to do?


:idea: Please read How to Request Help.
:idea: Please read the FAQ and How to Request Help.

itzak
Donor
Posts: 11
Joined: 30 Aug 2016, 10:39

Re: Recursive Rename of TV folders to add series date

Post by itzak » 05 Nov 2019, 11:59

Yes, these files were previously processed by filebot but without the year in the format at that time.

Code: Select all

 Are you processing files that have previously been processed with FileBot? But are somehow missing the year part?


Hi the format works perfectly on new files. My question is how to script a rename in place of the older folders that do not have the date so they will have a date like the newer ones. There are hundreds of them, so manually is not an option.

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

Re: Recursive Rename of TV folders to add series date

Post by rednoah » 05 Nov 2019, 12:07

:!: The following assumes that xattr metadata is available and working.

:idea: Please try with a single file for testing first.


1.
Drop all files (previously processed with FileBot) into New Names.


2.
Press F2. This will instantly load the corresponding Episode object for each file (via xattr metadata) into the New Names list and apply your format.


3.
You can now check if everything is in order. Files that already have the desired file path will be labelled and are subsequently ignored if you hit Rename. Everything else (i.e. the files without year) will be moved and renamed as usual.
:idea: Please read the FAQ and How to Request Help.

itzak
Donor
Posts: 11
Joined: 30 Aug 2016, 10:39

Re: Recursive Rename of TV folders to add series date

Post by itzak » 05 Nov 2019, 12:40

This works to a point. However, it is creating a new folder and placing a copy in the new location without removing the old video (.mp4, .mkv, etc) files. Because it's creating a new folder and not renaming, it is also leaving all the other .nfo, .jpg etc behind in the old folder.

I tested a few times, I was careful to be using the Rename function and not the copy function in the GUI

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

Re: Recursive Rename of TV folders to add series date

Post by rednoah » 05 Nov 2019, 18:17

1.
itzak wrote:
05 Nov 2019, 12:40
placing a copy in the new location without removing the old video (.mp4, .mkv, etc) files.
Are you sure? This is highly unlikely. If FileBot performs a Move / Rename operation, then it'll either work, or not work. If there's no error, then the move operation succeeded, meaning that the source file no longer exists. The operating system / file system typically guarantees this.

:idea: If you're using remote filesystems, then due to caching, you might see files that aren't actually there anymore.


2.
itzak wrote:
05 Nov 2019, 12:40
Because it's creating a new folder and not renaming, it is also leaving all the other .nfo, .jpg etc behind in the old folder.
Indeed, if you want to move a structure with arbitrary companion files, then you're out of luck.

:!: Conceptually, FileBot can only work with Movie / Episode objects, and so matching a "series folder" to "Series" object would require a separate "Series" mode and that's thus not supported.

:idea: My approach would be the above, and then call the cleaner script to delete left behind clutter files, and call the artwork script to download missing artwork / nfos for the new folders. Some familiarity with the command-line would be helpful here.
:idea: Please read the FAQ and How to Request Help.

Post Reply